Home » Eclipse Projects » EclipseLink » Strange behaviour if weaving is enabled
Strange behaviour if weaving is enabled [message #1067328] |
Mon, 08 July 2013 10:20 |
Reiner Lott Messages: 7 Registered: April 2013 |
Junior Member |
|
|
Hi,
i have a weird behaviour with embedded-objects in a SE-Environment, if weaving is enabled.
I use a contact entity which contains several embedded objects, e.g. adress, zipcode and some meta-information (RecordMetaData which extends RecordMetaData_Basic).
Setting the meta information before a persist (c = Contact-Entity) does nothing if weaving ist enabled:
c.getMetaInformation().setCreatedBy("Technical User");
c.getMetaInformation().setCreated(new Timestamp(new Date().getTime()));
Results in:
[EL Fine]: sql: 2013-07-08 11:43:41.313--ClientSession(33223668)--Connection(3042406)--Thread(Thread[main,5,main])--INSERT INTO Contact (ID, CONTACTNAME, CITY, STATECODE, STREET, CODENUMBER, CHANGED, CHANGEDBY, CREATED, CREATEDBY) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
bind => [8001, Java Duke, USA, SomeCode, 2nd Ave, 12345, null, null, null, null]
Only the merge for the first inheritance of the meta information is applied to the db:
found.getMetaInformation().setChanged(new Timestamp(new Date().getTime()));
found.getMetaInformation().setChangedBy("Another Technical User");
Results in:
[EL Fine]: sql: 2013-07-08 11:44:17.171--ClientSession(33223668)--Connection(3042406)--Thread(Thread[main,5,main])--UPDATE Contact SET CHANGED = ? WHERE (ID = ?)
bind => [2013-07-08 11:44:15.172, 8001]
==================================================
If weaving is disabled, all attributes are purged in the db:
[EL Fine]: sql: 2013-07-08 12:09:58.14--ClientSession(14215426)--Connection(15483616)--Thread(Thread[main,5,main])--INSERT INTO Contact (ID, CONTACTNAME, CITY, STATECODE, STREET, CODENUMBER, CHANGED, CHANGEDBY, CREATED, CREATEDBY) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
bind => [9001, Java Duke, USA, SomeCode, 2nd Ave, 12345, null, null, 2013-07-08 12:09:58.046, Technical User]
[EL Fine]: sql: 2013-07-08 12:10:17.666--ClientSession(14215426)--Connection(15483616)--Thread(Thread[main,5,main])--UPDATE Contact SET CHANGED = ?, CHANGEDBY = ? WHERE (ID = ?)
bind => [2013-07-08 12:10:16.199, Another Technical User, 9001]
==================================================
Why does this happen?
I use Eclipse Persistence Services - 2.4.1.v20121003-ad44345
A testcase is attached.
Cheers,
Reiner
|
|
|
Re: Strange behaviour if weaving is enabled [message #1067584 is a reply to message #1067328] |
Tue, 09 July 2013 13:01 |
|
The issue is that JPA does not support inheritance with Embeddables. So that is the root of your problem. If you remove the inheritance, I assume it will resolve the issue.
The difference in behavior is odd, my guess is that the superclass is not getting weaved, so it cannot detect changes.
You could try including @ChangeTracking(DEFERRED) or "eclipselink.weaving.changetracking"="false".
Also try the latest release, and if the issue still occurs, please log a bug.
James : Wiki : Book : Blog : Twitter
|
|
| |
Goto Forum:
Current Time: Thu Sep 19 09:13:23 GMT 2024
Powered by FUDForum. Page generated in 0.03924 seconds
|