I beleive primary keys must be Serializalble.  Try using an Integer object
instead.

Later 

Greg

-----Original Message-----
From: Hegyi Tibor [mailto:[EMAIL PROTECTED]]
Sent: Friday, December 01, 2000 2:47 AM
To: Orion-Interest
Subject: OR mapping with Oracle


Hi guys, 

Coupld you please help with teh below problem? I haven't found any solution
yet.

I am using Orion 1.3.8, Oracle 8.1.5.
I want to use a Compound object as a primary key to my CMP Entity Bean.
This PK class has one public member key of int datatype.

The PK class:
public class ProductPK implements java.io.Serializable {
  public int key;       //this should be mapped to a column in the Oracle
bean table
  public ProductPK(int key) {
    this.key=key;
  }
}

I edited orion-ejb-jar.xml to map the primary key field (this is necessary I
think, because Oracle maps Serializable objects to blobs that cannot be part
of primary keys):

<primkey-mapping>
<cmp-field-mapping name="key">
<fields>
<cmp-field-mapping name="key" persistence-name="key" />
</fields>
</cmp-field-mapping>
</primkey-mapping>

The error message I always got:

Auto-deploying beantest-ejb.jar (orion-ejb-jar.xml had been updated since
the previous deployment)... ProductRemote_EntityBeanWrapper0.java:781:
Incompatible type for method. Can't convert beantest.ejb.ProductPK to int.
                                        statement.setInt(4, object.key);
                                                                  ^
ProductHome_EntityHomeWrapper7.java:388: Incompatible type for method. Can't
convert beantest.ejb.ProductPK to int.
                                statement.setInt(4, response.object.key);
                                                                   ^
2 errors
Error compiling file:/E:/Java/BeanTest/build/beantest/beantest-ejb.jar:
Syntax error in source

I've already looked at OrionSupport and the mailing list archive, but found
no solution ti this problem.

Any idea would be gratefully appreciated!

Tibor




Reply via email to