Hello and once again, I nailed down the problem a bit but still do not have a good solution. It turns out that when I remove the Column-Definition for PART_KEY from the Freitext-Object, it works correctly. Actually, the OneToOne Relationship would be between the PART_KEY (Long/long/BigDecimal - i tried all of these) from the Partner-Object and the Column PART_KEY from the Freitext-Object. However, regardless what I specify as Type for the Column in Freitext, openJPA always tries to match the PART_KEY from Partner with an Integer-Value. I figured this out as the error message changes in this way:
If I set @Column(name = PART_KEY) private BigDecimal partKey; inside Freitext and @Column(name = PART_KEY) private Long partKey; inside Partner, the error is: java.lang.Integer is incompatible with java.lang.Long If I set @Column(name = PART_KEY) private BigDecimal partKey; inside Freitext and @Column(name = PART_KEY) private BigDecimal partKey; inside Partner, the error is: java.lang.Integer is incompatible with java.lang.BigDecimal Hmm, I'm unsure if I made my point clear. My current solution is just to leave out the JOIN-Column in the joined table Freitext, so not specify @Column(name = PART_KEY) private ... partKey at all, as it is not really necessary for me. Has anybody an idea why this happens in this way? Regards, Heiko [email protected] 16.04.2009 18:04 Bitte antworten an [email protected] An [email protected] Kopie Thema Re: Re: StrictIdentityValues Issues leading to !(x instanceof Long) Hello again, I exactly tried this now. But this time, the Error gets even weirder, cause now I get: java.lang.Integer is incompatible with java.lang.Long, were honestly NO single Integer is present in both classes. What is JPA trying to do here? Heiko [email protected] 15.04.2009 17:55 Bitte antworten an [email protected] An [email protected] Kopie Thema Re: StrictIdentityValues Issues leading to !(x instanceof Long) Try changing your keys from primitive long to java.lang.Long. -Rick 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. @Entity @Table(name = "FREITEXT") public class Freitext { @Id @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; } @Entity @Table(name = "PARTNER", schema = "PART") @NamedQuery(name = "getPartner", query = "SELECT p FROM Partner p where p.partKey = :partKey") public class Partner { @Id @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(ApplicationIds.java:159) at org.apache.openjpa.jdbc.meta.ClassMapping.getObjectId(ClassMapping.java:192) at org.apache.openjpa.jdbc.meta.ClassMapping.getObjectId(ClassMapping.java:146) at org.apache.openjpa.jdbc.meta.strats.RelationFieldStrategy.load(RelationFieldStrategy.java:531) at org.apache.openjpa.jdbc.meta.FieldMapping.load(FieldMapping.java:796) at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.load(JDBCStoreManager.java:833) at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.load(JDBCStoreManager.java:785) at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initializeState(JDBCStoreManager.java:336) at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initialize(JDBCStoreManager.java:255) at org.apache.openjpa.kernel.DelegatingStoreManager.initialize(DelegatingStoreManager.java:111) at org.apache.openjpa.kernel.ROPStoreManager.initialize(ROPStoreManager.java:57) at org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:844) at org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:802) at org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:724) at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.load(JDBCStoreManager.java:776) at org.apache.openjpa.jdbc.sql.AbstractResult.load(AbstractResult.java:257) at org.apache.openjpa.jdbc.sql.SelectImpl$SelectResult.load(SelectImpl.java:2267) at org.apache.openjpa.jdbc.meta.strats.RelationToManyInverseKeyFieldStrategy.loadElement(RelationToManyInverseKeyFieldStrategy.java:87) at org.apache.openjpa.jdbc.meta.strats.RelationCollectionInverseKeyFieldStrategy.loadElement(RelationCollectionInverseKeyFieldStrategy.java:76) at org.apache.openjpa.jdbc.meta.strats.StoreCollectionFieldStrategy.load(StoreCollectionFieldStrategy.java:479) at org.apache.openjpa.jdbc.meta.FieldMapping.load(FieldMapping.java:802) at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.load(JDBCStoreManager.java:485) at org.apache.openjpa.kernel.DelegatingStoreManager.load(DelegatingStoreManager.java:116) at org.apache.openjpa.kernel.ROPStoreManager.load(ROPStoreManager.java:78) at org.apache.openjpa.kernel.StateManagerImpl.loadFields(StateManagerImpl.java:2886) at org.apache.openjpa.kernel.StateManagerImpl.loadField(StateManagerImpl.java:2964) at org.apache.openjpa.kernel.StateManagerImpl.beforeAccessField(StateManagerImpl.java:1463) at org.apache.openjpa.kernel.StateManagerImpl.accessingField(StateManagerImpl.java:1448) at com.mbbank.model.Partner.pcGetfreitexte(Partner.java) at com.mbbank.model.Partner.getFreitexte(Partner.java:776) at com.mbbank.services.GetPersonHandler.createNotes(GetPersonHandler.java:366) 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. Sincerely, Heiko Kopp -- View this message in context: http://n2.nabble.com/StrictIdentityValues-Issues-leading-to-%21%28x-instanceof-Long%29-tp2637697p2639642.html Sent from the OpenJPA Users mailing list archive at Nabble.com. If you are not the intended addressee, please inform us immediately that you have received this e-mail in error, and delete it. We thank you for your cooperation. If you are not the intended addressee, please inform us immediately that you have received this e-mail in error, and delete it. We thank you for your cooperation.
