Hi all,
I'm new to hibernate. I started working on a Spring + hibernate project recently. Since I'm new to hibernate, i reversed engineered the DAOs from the database and went through them. I have 2 tables named user_roles and users in my database and the user_role_id column of users table references id column of user_roles table. (Foreign key constraint).
In the Users.java class i had all the setter methods to create a user object but no setters for user_role_id, instead of that there was a setter method for UserRoles object. So i thought to create a UserRoles object and set it so it will lookup and automatically assigns the id, but when creating the UserRoles object i found that it requires Set<Users> collection to be set since of the many to one relation. Nw I'm really confused how to insert a user record since there is a cyclic dependency in the classes. (I dont know whether this is the correct way, but since these are generated classes i thought this is the standard way to follow.)
Can anybody guide me how to insert a user record with user_role_id???
According to the rules of javaranch, i hereby inform that cross posting of this question is occuring
here
and since i didnt get any help there (till this post occured), i decided to post in javaranch.
Thanks in advance.