|
Prev: One table One Dao is the best practise?????
Next: Dumb Question -- How do you get rid of Spaces in JSP ExpressionForm Data?
From: Sachin on 7 Jul 2008 06:39 In the mapping file following section is there for the class GroupPage. <many-to-one name="BusinessUnit" class="BusinessUnit" access="nosetter.camelcase-underscore" not-null="true"/> But there is no attibute of a collection of <BusinessUnit> in the mapped class, but the relational table has a BusinessUnit column. Can this becomes a problem when persisting objects of GroupPage ? Actually the class and the mapping file is written by another party, I am new to hibernate and really value your suggestions.
From: Daniel Pitts on 7 Jul 2008 12:48
Sachin wrote: > In the mapping file following section is there for the class > GroupPage. > > <many-to-one name="BusinessUnit" > class="BusinessUnit" > access="nosetter.camelcase-underscore" > not-null="true"/> > > But there is no attibute of a collection of <BusinessUnit> in the > mapped class, but the relational table has a BusinessUnit column. > > Can this becomes a problem when persisting objects of GroupPage ? > > Actually the class and the mapping file is written by another party, I > am new to hibernate and really value your suggestions. Many-to-one is the same as a backward one-to-many. Remember, relations go both ways, where Object References don't have to. It is okay to put the foreign key column in the other table, rather than create a mapping table, since the table doesn't have to correspond directly to the object structure. They *are* different paradigms after all. Hmm, now that I read your post more closely, it could be that the BusinessUnit has a collection of GroupPages, but I would *think* the mapping should be one-to-many from the BusinessUnit If it works, don't fix it :-) -- Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/> |