I have a problem in creating proper hibernate mappings for my web application.
I have a table User (primary key is id
). The user table has data that doesn't change too often for a user. I have another table user_editable_data that has data editable by the user.
The table structure is as below
User id|username|password
user_editable_data id|info1|info2
The id in user_editable_data is same as User.id
I have two entities (User and UserEditableData) corresponding to the tables. My requirement is that i need to create an entry in user_editable_data table whenever an user is created.
I am able to do this successfully by using hibernate mappings by following the tutorial here. But with that i should have an object of User in UserEditableData class which i dont want to use.
I tried using mapping. But with that only the object of User is getting created when i persist User object.
Can someone suggest me a way to map User and UserEditableData such that when we persist/create User, UserEditableMapping should also get created with the same id as in User.
Any help is appreciated.