| Summary: | Lazy Basic Mapping not properly loaded after create, flush, refresh, commit | ||||||
|---|---|---|---|---|---|---|---|
| Product: | z_Archived | Reporter: | Tom Ware <tom.ware> | ||||
| Component: | Eclipselink | Assignee: | Tom Ware <tom.ware> | ||||
| Status: | CLOSED FIXED | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | eclipselink.foundation-inbox | ||||
| Version: | unspecified | ||||||
| Target Milestone: | --- | ||||||
| Hardware: | PC | ||||||
| OS: | Windows XP | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
Created attachment 203357 [details]
proposed fix
Proposed fix propogates change set to a newly built clone from the source during the merge. Checked into trunk Reviewed by Andrei Ilitchev Added test to DDLGenerationTestSuite Tested with Core and JPA LRG 2.3, 2.2 and 2.1 check-ins to follow. Retargetting. Backport is risky due to amount of supporting API that needs to be backported to get the session need to deal with the fetch group. Changes checked into 2.3.1 The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink |
If you have a LAZY Basic mapping and populate it in a new object. A call to flush and then refresh can corrupt it in the shared cache. Here is a test case for our DDL Generation Model: // Bug public void testLazyBlob(){ EntityManager em = createEntityManager(DDL_TPC_PU); beginTransaction(em); LuxuryCar car = new LuxuryCar(); try { java.io.ByteArrayOutputStream baos = new java.io.ByteArrayOutputStream(); java.io.PrintWriter pw = new java.io.PrintWriter(baos); pw.print("TestString1"); pw.close(); baos.close(); car.setPic( baos.toByteArray()); } catch (Exception e) { e.printStackTrace(); fail("we failed!!!"); } em.persist(car); em.flush(); em.refresh(car); commitTransaction(em); em.clear(); car = em.find(LuxuryCar.class, car.getRegNumber()); byte[] pic = car.getPic(); assertTrue("Blob was null after flush, refresh, commit.", pic != null); }