Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Unmapped attributes of superclass have wrong value
Unmapped attributes of superclass have wrong value [message #1386414] Tue, 17 June 2014 12:25 Go to next message
Stefan Loewe is currently offline Stefan LoeweFriend
Messages: 2
Registered: June 2014
Junior Member
Hi,
I have a problem with eclipselink 2.5.1. In 2.5.0, everything works fine.

Overview:
When reading an object from the DB, one of its (unmapped) attributes does not get its default value.
When debugging the problem, I was able to follow the execution until the method buildNewInstance() in internal.descriptors.PersistenceObjectInstantiationPolicy. The debugger could not dig further into that method.

Some details:
we want to read an instance of the entity MyVO from the DB. MyVO extends an abstract class BaseVO which defines the private attribute 'existing'. This attribute is not mapped to the DB and has default value true:

private boolean existing = true;


But when eclipselink returns MyVO, the value of existing is 'false'.
Strange enough, when reading AnotherVO from the DB, which also extends BaseVO, the attribute 'existing' has the correct value 'true'.

The difference between MyVO and AnotherVO is, that they live in different EJB jars, so I suspected a different configuration in persistence.xml. However, the configurations are as identical as they can be:

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0"
... i get into trouble when i try to post with the links here ...  
>
	<persistence-unit name="MyEJB or AnotherEJB" transaction-type="JTA">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<jta-data-source>jdbc/xxxx or jdbc/yyyy</jta-data-source>
<class>...MyVO or ...AnotherVO</class>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
	<properties>
		<property name="eclipselink.cache.shared.default" value="false" />
		<property name="eclipselink.jdbc.bind-parameters" value="true" />
		<property name="eclipselink.persistence-context.flush-mode" 	value="commit" />
		<property name="eclipselink.persistence-context.reference-mode" value ="WEAK" />
		<property name="eclipselink.target-database" value="org.eclipse.persistence.platform.database.oracle.Oracle11Platform"/>	
		<property name="eclipselink.target-server" value="WebSphere" />	
		<property name="eclipselink.weaving" value="dynamic" />
		</properties>
	</persistence-unit>
</persistence>


I observed the following:
Inside PersistenceObjectInstantiationPolicy#buildNewInstance() we have a call
	return factory._persistence_new(factory);

where 'factory' is a sort of MyVO (or AnotherVO). In 'factory', the value of 'existing' is set correctly to 'true'.

When weaving is switched off for the persistence unit 'MyEJB', the error disappears.

Since eclipselink 2.5.0 works fine, I would like to ask whether you have an idea how I could make eclipselink 2.5.1 working for me.

Thank you and best regards,
Stefan
Re: Unmapped attributes of superclass have wrong value [message #1386586 is a reply to message #1386414] Wed, 18 June 2014 11:59 Go to previous message
Stefan Loewe is currently offline Stefan LoeweFriend
Messages: 2
Registered: June 2014
Junior Member
Addendum:
As soon as I add the serialVersionUID to the serializable class MyVO, the error disappears!

To the developers: does this make sense to you? Could you explain what changed from 2.5.0 to 2.5.1 such that the serialVersionUID became so important? I would be very grateful if you could explain to me what happens here.
Previous Topic:Multitenancy & single table inheritance
Next Topic:Spring managed transactions, EclipseLink JPA, custom isolation level
Goto Forum:
  


Current Time: Fri Apr 26 13:49:01 GMT 2024

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

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

Back to the top