I have two POJOs, User and Factory. I have three tables, t_user, t_factory and t_user_factory
t_user has user profile (primary key is user_id) t_factory has factory details (primary key is factory_id) t_user_factory has user's assigned factories (user_id and factory_id are only columns here). The reason why t_user is not having a factory_id is that t_user will have lot of redudant data as one user can have many factories.
How I can get list of factories for a user using Hibernate? I declared a Set of factories inside User object. If I use the following code in User.hbm.xml, it is not recognizing the USER_ID column,it says invalid column name. <class name="User" table="t_user" lazy="true"> : : <set name="factories" table="t_user_factory" lazy="false"> <key column="USER_ID" /> <one-to-many class="Factory"/> </set>
: : </class>
[ March 06, 2008: Message edited by: Vinod Kumar ] [ March 06, 2008: Message edited by: Vinod Kumar ]