Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 320233 - Lazy fetched ManyToOne field of an embedded object of a newly persisted entity will be set to null on commit
Summary: Lazy fetched ManyToOne field of an embedded object of a newly persisted entit...
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P2 normal (vote)
Target Milestone: ---   Edit
Assignee: Nobody - feel free to take it CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-19 05:21 EDT by Igor Mukhin CLA
Modified: 2022-06-09 10:34 EDT (History)
2 users (show)

See Also:


Attachments
JUnit Test that fails (9.07 KB, application/zip)
2010-07-23 14:52 EDT, Igor Mukhin CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Igor Mukhin CLA 2010-07-19 05:21:35 EDT
Build Identifier: 20100617-1415

The detailed information is posted to
http://www.eclipse.org/forums/index.php?t=msg&goto=547642
PLEASE READ THIS POST (it has screenshots)

Reproducible: Always

Steps to Reproduce:
I have an entity Entity1 with a field Embedded1 embedded1.
The class Embedded1 has a field:
@ManyToOne(fetch=FetchType.LAZY) private Person person;

To reproduce the problem:
- create new Entity1 instance with embedded1 and person set
- em.persist(entity1);
- em.commit();
- try read em.find(Entity1.class, id).getEmbedded1().getPerson() will always return null
Comment 1 Igor Mukhin CLA 2010-07-23 14:52:26 EDT
Created attachment 175094 [details]
JUnit Test that fails

This is a small Maven project than demonstrates the bug.

It contains of 
- two @entity classes and one @embeddable, 
- persistence.xml, 
- pom.xml (does static weaving after compiling)
- JUnit test that fails

To run:
- unpack the zip
- run "mvn test"
- Test will fail on second Assert.assertNotNull
Comment 2 Igor Mukhin CLA 2010-07-23 14:55:59 EDT
Important point: weaving required to reproduce
Comment 3 Igor Mukhin CLA 2010-07-23 15:00:59 EDT
pom.xml references EclipseLink 2.2.0-M1, but the same is with 2.1.0
Comment 4 Tom Ware CLA 2010-08-09 13:56:01 EDT
Setting target and priority.  See the following page for details of the meanings of these fields:

http://wiki.eclipse.org/EclipseLink/Development/Bugs/Guidelines
Comment 5 Igor Mukhin CLA 2011-07-22 04:19:55 EDT
It looks like it was fixed in 2.3.0
Comment 6 Tom Ware CLA 2011-07-22 08:19:49 EDT
Closing because of above comment.
Comment 7 Eclipse Webmaster CLA 2022-06-09 10:34:40 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink