Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: @NotNull and OneToOne mapping
PostPosted: Fri Nov 15, 2013 5:34 am 
Newbie

Joined: Fri Nov 15, 2013 5:25 am
Posts: 1
Hello,

i don't have the same behaviour by using @NotNull on a OneToOne relationship (to enforce a 1<>1 relationship) :
- when using @JoinColumn and a foreign key to build the OneToOne relationship , everything works fine. Hibernate raise an exception if a @NotNull field is null at saving time.
- but when using using @JoinTable and an intermediate association table, at saving time Hibernate complains about a transient issue : "org.hibernate.TransientPropertyValueException: Not-null property references a transient > value - transient instance must be saved before current operation."

Why @NotNulll annotation is caring about transient issue in the @JoinTable case and not in @JoinColum case ?


Thanks !


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.