I have the following tables in sqlite (in create table statement): CREATE TABLE users ( id autoinc_int, name varchar(30), password varchar(30) );
CREATE TABLE roles ( id autoinc_int, name varchar(20) ); CREATE TABLE users_roles ( id autoinc_int, user_id int, role_id int, foreign key(user_id) references users(id), foreign key(role_id) references roles(id) ); and the following classes: TUser = class(TtiObject) private FName: String; FPassword: String; FRoles: TRoles; published property OID; property Name: String read FName write FName; property Password: String read FPassword write FPassword; property Roles: TRoles read FRoles write FRoles; end; TRole = class(TtiObject) private FName: String; published property OID; property Name: String read FName write FName; end; they're mapped with: with gTIOPFManager.ClassDBMappingMgr do begin RegisterMapping(TUser,'users','OID','id',[pktDB]); RegisterMapping(TUser,'users','Name','name'); RegisterMapping(TUser,'users','Password','password'); RegisterMapping(TUser,'users_roles','Roles','???'); // <-- what should I fill it with? RegisterCollection(TUsers,TUser); end; with gTIOPFManager.ClassDBMappingMgr do begin RegisterMapping(TRole,'roles','OID','id',[pktDB]); RegisterMapping(TRole,'roles','Name','name'); RegisterCollection(TRoles,TRole); end; I need to have access to TUser.Roles[i].Name -- View this message in context: http://free-pascal-general.1045716.n5.nabble.com/tiOPF-automapping-for-m-n-relationships-tp5611128p5611128.html Sent from the Free Pascal - General mailing list archive at Nabble.com. _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal