- This topic has 2 replies, 2 voices, and was last updated 13 years, 1 month ago by ameelin.
-
AuthorPosts
-
ameelinMemberSay I have a Dept-to-Employee table(classic 1-many relation)
And I have Employee-ContractEmployee and Employee-FTEmployee tables
Can me4s magically detect that the former is just a 1-many vs the latter is a subclass relation. There should be some cue in table..what should that be for me4s to detect the difference?
cconwayMemberME4S will not detect a “subclass” relationship from the database. If you have a table that maps two entities, like a department-employee table, that should be seen as a many to many relationship by ME4S. A one to many relationship would be modeled by a foreign key.
In order to have subclasses, you would need to either modify the Java objects scaffolded from the database, or scaffold from Java beans that have the subclass relationships already coded. In the case of scaffolding from Java beans, you may still need to add the proper spring annotations to get your entities modeled in the database in the manner you expect.
ameelinMember@cconway wrote:
ME4S will not detect a “subclass” relationship from the database. If you have a table that maps two entities, like a department-employee table, that should be seen as a many to many relationship by ME4S. A one to many relationship would be modeled by a foreign key.
In order to have subclasses, you would need to either modify the Java objects scaffolded from the database, or scaffold from Java beans that have the subclass relationships already coded. In the case of scaffolding from Java beans, you may still need to add the proper spring annotations to get your entities modeled in the database in the manner you expect.
Thanks for the speedy response. I am thinking it is an ORM provider limitation. I am surprised that none of the providers allow any kind of cues (which would be useful for green projects than legacy) that would help automate this. Cues like column-names or via reading an external config file 🙁 Maybe you folks should have this input from user-to select tables in db which are Parent and which are children to that.
-
AuthorPosts