-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Error insert null in JoinColumn
PostPosted: Mon May 13, 2013 9:31 am 
Newbie

Joined: Mon May 13, 2013 9:15 am
Posts: 1
Hi,

I have an issue that I can't find any solution or workaround.

My problem is the following.
I have a STATELESS EJB which is called to persist an entity.

The first step of the method is to get the correct object (entity) from the DB by:
Code:
Foo lFoo = entitymanager.find(1,Foo.class).

Then I try to change one of the relationship entity like this:
Code:
lFoo.setBar(entitymanager.fin(1,Bar.class));


With the debugger, I can see the good bar object in lFoo. (In fact, a javassist of the object)
But when I try to save lFoo, I get an error from DB claiming that null is passed to bar value.

I try to do;
Code:
lFoo.setBar(new Bar);

And I get the classical error 'save the transient before flushing' which is great, so I clearly do not understand why Hibernate did not save the correct value in the first example.

I spent my last week-end on that and I have no more idea to deal with that issue.
If somebody have any clue that I can follow...

Thanks everyone,
Aubertinp


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 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.