Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] JoinColumn ManyToOne set to null on INSERT - circular reference?

You code looks correct, and there does not seem to be a cycle of foreign key
relationships (OneToMany is ok), unless the User has a reference back to the
FacilitySession?

Ensure that you are setting the Session on the FacilitySession, check the
value of the variable before you call flush.  Also ensure that your
FacilitySession references the correct Session from the same persistence
context, not a different one.

How do you persist the objects?  Are you using merge?

Try turning logging on finest, that may give more info.


doobs wrote:
> 
> I am wondering if the problem has to do with EclipseLink
> handling of circular entity references, because essentially 
> one user Session entity maintains a collection of FacilitySession 
> references which in turn point back to the user Session.
> 
> Maybe there are some tricks required to coax EclipseLink to handle that?
> 
> 
> On Fri, 3 Jun 2011, doobs wrote:
>> Disclaimer: I am not a J2EE developer so I don't have any proper
>> background
>> in this
>> (so please excuse me when I get the lingo wrong).
>> 
>> I am trying to migrate an old  (now unsupported) app from Glassfish-2.6
>> to
>> Glassfish-3.0.1 and
>> have tried to simply switch the JPA from the old toplink essentials to
>> eclipselink 2.0.
>> When 2.0 didn't seem to work, I made a switch to 2.2.0, but still have
>> the
>> same issue.
>> I am building/deploying on Windows XP using NetBeans 6.9.1, and
>> persisting
>> to a
>> remote Oracle-XE instance.
>> 
>> Under the original configuration, the App worked fine, but now it
>> doesn't.
>> In essence, there are
>> 2 entities that need to be persisted to 2 tables of the database and one
>> has a foreign key
>> reference to the other. Unfortunately, when the persistence takes place,
>> a
>> new row is written
>> to each table, but the foreign key is set to null.
>> 
>> 
>> The source for the entities is here:
>> 
>> http://code.google.com/p/icat-dataportal/source/browse/branches/dataminx0/
>> coreutil/src/uk/ac/dl/dp/coreutil/entity/Session.java
>> 
>> http://code.google.com/p/icat-dataportal/source/browse/branches/dataminx0/
>> coreutil/src/uk/ac/dl/dp/coreutil/entity/FacilitySession.java
>> 
> 
> 


-----
http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland 
http://www.eclipse.org/eclipselink/
 EclipseLink ,  http://www.oracle.com/technology/products/ias/toplink/
TopLink 
Wiki:  http://wiki.eclipse.org/EclipseLink EclipseLink , 
http://wiki.oracle.com/page/TopLink TopLink 
Forums:  http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink , 
http://www.nabble.com/EclipseLink-f26430.html EclipseLink 
Book:  http://en.wikibooks.org/wiki/Java_Persistence Java Persistence 
Blog:  http://java-persistence-performance.blogspot.com/ Java Persistence
Performance 
-- 
View this message in context: http://old.nabble.com/JoinColumn-ManyToOne-set-to-null-on-INSERT-tp31762115p31800335.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top