Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Strange behaviour if weaving is enabled
icon9.gif  Strange behaviour if weaving is enabled [message #1067328] Mon, 08 July 2013 10:20 Go to next message
Reiner Lott is currently offline 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 Go to previous messageGo to next message
James Sutherland is currently offline James Sutherland
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

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
Re: Strange behaviour if weaving is enabled [message #1067607 is a reply to message #1067584] Tue, 09 July 2013 14:43 Go to previous message
Reiner Lott is currently offline Reiner Lott
Messages: 7
Registered: April 2013
Junior Member
Hi James,

@ChangeTracking(DEFERRED) has no effect (in 2.4) - in 2.5 this behaviour does not exist anymore!

Thanks for your help,

Cheers Reiner

[Updated on: Wed, 10 July 2013 05:51]

Report message to a moderator

Previous Topic:Not able to get the inserted Entity after Query.getSingleResult(INSERT INTO..... VALUES......)
Next Topic:Cache coordination per entity type
Goto Forum:
  


Current Time: Thu Oct 30 16:12:42 GMT 2014

Powered by FUDForum. Page generated in 0.01692 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software