Re: OR mapping with Oracle
You can use complex OR mapping with orion, for instance if you have an compound PK object you can map all its fields to different columns in the database table See orionsupport - complex or mapping http://www.orionsupport.com/articles/complex-or.html - Original Message - From: "Hegyi Tibor" [EMAIL PROTECTED] To: "Orion-Interest" [EMAIL PROTECTED] Sent: Monday, December 04, 2000 7:46 AM Subject: RE: OR mapping with Oracle Thanks for your reply. My PK class implements the Serializable interface (see code snippet in my first mail) but this does not help since Orion maps Serializable objects to blob datatypes in relation with Oracle data source and blobs cannot be indexed. Integer object works fine but how can I implement compound primary keys then? Tibor -Original Message- From: J Davis [mailto:[EMAIL PROTECTED]] Sent: Friday, December 01, 2000 9:38 PM To: Orion-Interest Subject: RE: OR mapping with Oracle I beleive primary keys must be Serializalble. Try using an Integer object instead. Later Greg
RE: OR mapping with Oracle
Hi Wim, In my code snippet I have shown the mapping in orion-ejb-jar.xml, that is as follows: primkey-mapping cmp-field-mapping name="key" fields cmp-field-mapping name="key" persistence-name="key" / /fields /cmp-field-mapping /primkey-mapping This "compound" PK class has one field for sake of simplicity. I tried to follow the instructions of the article you have also mentioned but still got that ugly error. 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 So am still lost with this issue. Thanks! -Original Message- From: wim veninga [mailto:[EMAIL PROTECTED]] Sent: Monday, December 04, 2000 1:01 PM To: Orion-Interest Subject: Re: OR mapping with Oracle You can use complex OR mapping with orion, for instance if you have an compound PK object you can map all its fields to different columns in the database table See orionsupport - complex or mapping http://www.orionsupport.com/articles/complex-or.html - Original Message - From: "Hegyi Tibor" [EMAIL PROTECTED] To: "Orion-Interest" [EMAIL PROTECTED] Sent: Monday, December 04, 2000 7:46 AM Subject: RE: OR mapping with Oracle Thanks for your reply. My PK class implements the Serializable interface (see code snippet in my first mail) but this does not help since Orion maps Serializable objects to blob datatypes in relation with Oracle data source and blobs cannot be indexed. Integer object works fine but how can I implement compound primary keys then? Tibor -Original Message- From: J Davis [mailto:[EMAIL PROTECTED]] Sent: Friday, December 01, 2000 9:38 PM To: Orion-Interest Subject: RE: OR mapping with Oracle I beleive primary keys must be Serializalble. Try using an Integer object instead. Later Greg
RE: OR mapping with Oracle
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