openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick Curtis <>
Subject Re: StrictIdentityValues Issues leading to !(x instanceof Long)
Date Wed, 15 Apr 2009 15:53:21 GMT

Try changing your keys from primitive long to java.lang.Long.


I'm having some problems with the Property 'openjpa.Compatibility' and the Value StrictIdentityValues=false.We
are using IBM Websphere 6.1 incl. EJB3 Feature Pack (openJPA 1.0.4-SNAPSHOT) which by default
sets this value to 'true'. In the following Scenario, I get an exception which I do not understand,
as I can't find a problem with the types of the Id-Fields.

@Table(name = "FREITEXT")
public class Freitext 
	@Column(name = "FREITEXT_KEY")
	private long key;
	@Column(name = "PART_KEY")
	private long partKey;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "PART_KEY")
	private Partner partner;

@Table(name = "PARTNER", schema = "PART")
@NamedQuery(name = "getPartner", query = "SELECT p FROM Partner p where p.partKey = :partKey")
public class Partner 
	@Column(name = "PART_KEY")
	private long partKey;

	@OneToMany(mappedBy = "partner", fetch = FetchType.LAZY)
	private List<Freitext> freitexte;

In case StrictIdentityValues is set 'true' (as default for the Websphere), this leads to the
following Exception when accessing parter.getFreitexte().

[15.04.09 10:43:45:577 CEST] 00000022 SystemErr     R Caused by: java.lang.ClassCastException:
!(x instanceof Long)
	at org.apache.openjpa.util.ApplicationIds.fromPKValues(
	at org.apache.openjpa.jdbc.meta.ClassMapping.getObjectId(
	at org.apache.openjpa.jdbc.meta.ClassMapping.getObjectId(
	at org.apache.openjpa.jdbc.meta.strats.RelationFieldStrategy.load(
	at org.apache.openjpa.jdbc.meta.FieldMapping.load(
	at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.load(
	at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.load(
	at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initializeState(
	at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initialize(
	at org.apache.openjpa.kernel.DelegatingStoreManager.initialize(
	at org.apache.openjpa.kernel.ROPStoreManager.initialize(
	at org.apache.openjpa.kernel.BrokerImpl.initialize(
	at org.apache.openjpa.kernel.BrokerImpl.find(
	at org.apache.openjpa.kernel.BrokerImpl.find(
	at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.load(
	at org.apache.openjpa.jdbc.sql.AbstractResult.load(
	at org.apache.openjpa.jdbc.sql.SelectImpl$SelectResult.load(
	at org.apache.openjpa.jdbc.meta.strats.RelationToManyInverseKeyFieldStrategy.loadElement(
	at org.apache.openjpa.jdbc.meta.strats.RelationCollectionInverseKeyFieldStrategy.loadElement(
	at org.apache.openjpa.jdbc.meta.strats.StoreCollectionFieldStrategy.load(
	at org.apache.openjpa.jdbc.meta.FieldMapping.load(
	at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.load(
	at org.apache.openjpa.kernel.DelegatingStoreManager.load(
	at org.apache.openjpa.kernel.ROPStoreManager.load(
	at org.apache.openjpa.kernel.StateManagerImpl.loadFields(
	at org.apache.openjpa.kernel.StateManagerImpl.loadField(
	at org.apache.openjpa.kernel.StateManagerImpl.beforeAccessField(
	at org.apache.openjpa.kernel.StateManagerImpl.accessingField(
	at com.mbbank.model.Partner.pcGetfreitexte(
	at com.mbbank.model.Partner.getFreitexte(

If I set it to 'false', it works out quite well. Is somebody able to bring some light in this
issue, preferably why it might be necessary to have StrictIdentityValues set 'false' and where
my mistake could be? Any ideas would be gladly welcome.


Heiko Kopp

View this message in context:
Sent from the OpenJPA Users mailing list archive at

View raw message