Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Object Relational Mapping and the fly likes One2One Uni-directional Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Reply Bookmark "One2One Uni-directional Problem" Watch "One2One Uni-directional Problem" New topic
Author

One2One Uni-directional Problem

S Subbu
Ranch Hand

Joined: Mar 20, 2012
Posts: 87

Hi , I am Using JPA Annotation .

My Problem is i associate One2One Uni - directional Relation. My Actual Problem is

In Table1




Insert Code




But When was insert Record , i got exception like assign value to id in com.entity.Table2 before calling save()



I dont want to assign id value , it will get From Table1 Id value . What i have to do for this.


Thanks
Prabaharan Gopalan
Ranch Hand

Joined: Oct 16, 2009
Posts: 66

The id in Table2 is the primary key for table2. Unless you have a generation strategy specified for that Id, you'd have to manually set the id.


Googling doesn't make you a genius. But not Googling makes you dumber.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: One2One Uni-directional Problem
 
Similar Threads
Hibernate and extra insert
Temporary objects
Hibernate: Different Join in Save() and Get()
DELETE using subquery
Getting one Row from JOIN query