Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] @OneToMany on fields with em.persist() - Different behavior for EclipseLink 2.1

So, if I understand, you have an attribute that is not cascade persist and
you are lazy initializing it using your own get method and were relying on
EclipseLink persist to call this get method, because you are not going
through the get method in your application?

Seems like your code is wrong, if you want to lazy initialize something in a
get method, you need to use that get method in your application.

Perhaps include the null pointer exception stack trace.


orgler wrote:
> 
> I just further investigated this problem. I think this is a bug caused by
> the following performance-patch:
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=283335
> 
> <https://bugs.eclipse.org/bugs/show_bug.cgi?id=283335>I posted
> my thoughts over there, unfortunately I cannot reopen a bug :-(
> 
> 
> Best regards,
> 
> Johannes Michler
> 
> 2010/7/7 Johannes Michler <orgler@xxxxxxxxx>
> 
>> Hi,
>>
>> we're developping an eclipse-rcp-application using Eclipselink. We have
>> an
>> Entity Group and an Entity Person with a OneToMany Relationship from
>> Group
>> to Person:
>>
>> @Entity
>> Group{
>>    @OneToMany(mappedBy="m_group")
>> public List<Person> m_persons;
>> }
>>
>> Using this we're doing the following:
>> Group g = new Group();
>> em.persist(g);
>>
>>
>> On EclipseLink 1.1 (Galileo-Release) g.m_persons was set to an
>> "Lazy-Instance" Set after this call to persist(). But with eclipse 2.1
>> (Helios) g.m_persons is null.
>>
>> Why is there a change of semantic? Can I get the "old" behavior? When
>> setting Cascade=Cascade.Persist it seems to work. But we have many
>> Entities
>> in a similar way in our application and this would need us to change big
>> parts of our persistence-logic :-( Furthermore I don't know what other
>> Problems this would cause. Are there more such semantic-changes with
>> Eclipselink 2.1?
>>
>>
>>
>> Best regards
>> Johannes
>>
> 
> 
> 


-----
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 
-- 
View this message in context: http://old.nabble.com/%40OneToMany-on-fields-with-em.persist%28%29---Different-behavior-for-EclipseLink-2.1-tp29100231p29150492.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top