geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gianny Damour (JIRA)" <...@geronimo.apache.org>
Subject [jira] Updated: (GERONIMO-1361) CMP having a compound PK with only one field are not supported
Date Wed, 14 Dec 2005 11:04:45 GMT
     [ http://issues.apache.org/jira/browse/GERONIMO-1361?page=all ]

Gianny Damour updated GERONIMO-1361:
------------------------------------

    Summary: CMP having a compound PK with only one field are not supported  (was: CMP having
a compound PK with only one fields are not supported)

> CMP having a compound PK with only one field are not supported
> --------------------------------------------------------------
>
>          Key: GERONIMO-1361
>          URL: http://issues.apache.org/jira/browse/GERONIMO-1361
>      Project: Geronimo
>         Type: Bug
>   Components: OpenEJB
>     Versions: 1.0-M5
>     Reporter: Gianny Damour
>     Assignee: Gianny Damour
>     Priority: Minor
>      Fix For: 1.0

>
> I have replicated the issue in a simple EJB,the example CMP in Ed Roman's book Mastering
EJB. I am attaching the stack trace and the plans below
> 17:02:05,211 WARN  [SystemExceptionInterceptor] Product
> java.lang.ClassCastException
>         at org.tranql.sql.jdbc.binding.StringBinding.setValue(StringBinding.java:43)
>         at org.tranql.sql.jdbc.binding.TypeConverterBinding.setValue(TypeConverterBinding.java:93)
>         at org.tranql.sql.jdbc.binding.TypeConverterBinding.setValue(TypeConverterBinding.java:89)
>         at org.tranql.sql.jdbc.JDBCQueryCommand.execute(JDBCQueryCommand.java:64)
>         at org.tranql.cache.cache.FindByPKCacheQueryCommand.execute(FindByPKCacheQueryCommand.java:6
> 6)
>         at org.openejb.entity.cmp.CMPFinder.execute(CMPFinder.java:98)
>         at org.openejb.entity.cmp.SingleValuedFinder.execute(SingleValuedFinder.java:80)
>         at org.openejb.dispatch.DispatchInterceptor.invoke(DispatchInterceptor.java:72)
>         at org.apache.geronimo.naming.java.ComponentContextInterceptor.invoke(ComponentContextInterc
> eptor.java:56)
>         at org.openejb.ConnectionTrackingInterceptor.invoke(ConnectionTrackingInterceptor.java:81)
>         at org.openejb.entity.EntityInstanceInterceptor.invoke(EntityInstanceInterceptor.java:136)
>         at org.openejb.entity.cmp.InTxCacheInterceptor.invoke(InTxCacheInterceptor.java:90)
>         at org.openejb.transaction.ContainerPolicy$TxRequired.invoke(ContainerPolicy.java:140)
>         at org.openejb.transaction.TransactionContextInterceptor.invoke(TransactionContextIntercepto
> r.java:80)
>         at org.openejb.SystemExceptionInterceptor.invoke(SystemExceptionInterceptor.java:82)
>         at org.openejb.GenericEJBContainer.invoke(GenericEJBContainer.java:238)
>         at org.openejb.server.ejbd.EjbRequestHandler.invoke(EjbRequestHandler.java:297)
>         at org.openejb.server.ejbd.EjbRequestHandler.doEjbHome_FIND(EjbRequestHandler.java:394)
>         at org.openejb.server.ejbd.EjbRequestHandler.processRequest(EjbRequestHandler.java:209)
>         at org.openejb.server.ejbd.EjbDaemon.service(EjbDaemon.java:150)
>         at org.openejb.server.ejbd.EjbServer.service(EjbServer.java:87)
>         at org.openejb.server.ejbd.EjbServer$$FastClassByCGLIB$$d379d2ff.invoke(<generated>)
>         at net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java:53)
>         at org.apache.geronimo.gbean.runtime.FastMethodInvoker.invoke(FastMethodInvoker.java:38)
>         at org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:118)
>         at org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:800)
>         at org.apache.geronimo.gbean.runtime.RawInvoker.invoke(RawInvoker.java:57)
>         at org.apache.geronimo.kernel.basic.RawOperationInvoker.invoke(RawOperationInvoker.java:36)
>         at org.apache.geronimo.kernel.basic.ProxyMethodInterceptor.intercept(ProxyMethodInterceptor.
> java:96)
>         at org.activeio.xnet.ServerService$$EnhancerByCGLIB$$e80ad14.service(<generated>)
>         at org.activeio.xnet.ServicePool$2.run(ServicePool.java:67)
>         at org.activeio.xnet.ServicePool$3.run(ServicePool.java:90)
>         at org.apache.geronimo.pool.ThreadPool$ContextClassLoaderRunnable.run(ThreadPool.java:138)
>         at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(Unknown Source)
>         at java.lang.Thread.run(Unknown Source)
> setEntityContext called
> ejbActivate() called.
> ejbLoad() called.
> ejb-jar.xml
> <?xml version="1.0"?>
> <ejb-jar xmlns="http://java.sun.com/xml/ns/j2ee"
>          version="2.1"
>          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>          xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd">
>  
>   <display-name>Product</display-name>
>   <enterprise-beans>
>     <entity>
>       <ejb-name>Product</ejb-name>
>       <home>examples.cmp.ProductHome</home>
>       <remote>examples.cmp.Product</remote>
>       <ejb-class>examples.cmp.ProductBean</ejb-class>
>       <persistence-type>Container</persistence-type>
>       <prim-key-class>examples.cmp.ProductPK</prim-key-class>
>      
>       <reentrant>false</reentrant>
>      
>       <cmp-version>2.x</cmp-version>
>       <abstract-schema-name>PRODUCTS</abstract-schema-name>
>      
>       <cmp-field>
>         <field-name>productID</field-name>
>       </cmp-field>
>       <cmp-field>
>         <field-name>name</field-name>
>       </cmp-field>
>       <cmp-field>
>         <field-name>description</field-name>
>       </cmp-field>
>       <cmp-field>
>         <field-name>basePrice</field-name>
>       </cmp-field>
>      
>      
>  <!--     <query>
>         <query-method>
>           <method-name>findByPrimaryKey</method-name>
>           <method-params>
>             <method-param>examples.cmp.ProductPK</method-param>
>           </method-params>
>         </query-method>
>         <ejb-ql>SELECT DISTINCT OBJECT(p) FROM PRODUCTS p WHERE p.productID = ?1
>         </ejb-ql>
>       </query> -->
>      
>       <query>
>         <query-method>
>           <method-name>findByName</method-name>
>           <method-params>
>             <method-param>java.lang.String</method-param>
>           </method-params>
>         </query-method>
>         <ejb-ql>SELECT DISTINCT OBJECT(p) FROM PRODUCTS p WHERE p.name = ?1
>         </ejb-ql>
>       </query>
>       <query>
>         <query-method>
>           <method-name>findByDescription</method-name>
>           <method-params>
>             <method-param>java.lang.String</method-param>
>           </method-params>
>         </query-method>
>         <ejb-ql>SELECT DISTINCT OBJECT(p) FROM PRODUCTS p WHERE p.description =
?1
>         </ejb-ql>
>       </query>
>       <query>
>         <query-method>
>           <method-name>findByBasePrice</method-name>
>           <method-params>
>             <method-param>double</method-param>
>           </method-params>
>         </query-method>
>         <ejb-ql>SELECT DISTINCT OBJECT(p) FROM PRODUCTS p WHERE p.basePrice = ?1</ejb-ql>
>       </query>
>       <query>
>         <query-method>
>           <method-name>findExpensiveProducts</method-name>
>           <method-params>
>             <method-param>double</method-param>
>           </method-params>
>         </query-method>
>         <ejb-ql><![CDATA[SELECT DISTINCT OBJECT(p) FROM PRODUCTS p WHERE p.basePrice
> ?1]]></ejb-ql>
>       </query>
>       <query>
>         <query-method>
>           <method-name>findCheapProducts</method-name>
>           <method-params>
>             <method-param>double</method-param>
>           </method-params>
>         </query-method>
>         <ejb-ql><![CDATA[SELECT DISTINCT OBJECT(p) FROM PRODUCTS p WHERE p.basePrice
< ?1]]></ejb-ql>
>       </query>
>       <query>
>         <query-method>
>           <method-name>findAllProducts</method-name>
>           <method-params>
>           </method-params>
>         </query-method>
>         <ejb-ql>SELECT DISTINCT OBJECT(p) FROM PRODUCTS p WHERE p.productID IS
NOT NULL</ejb-ql>
>       </query>
>     </entity>
>   </enterprise-beans>
>  
>   <assembly-descriptor>
>     <container-transaction>
>       <method>
>         <ejb-name>Product</ejb-name>
>         <method-intf>Remote</method-intf>
>         <method-name>*</method-name>
>       </method>
>       <method>
>         <ejb-name>Product</ejb-name>
>         <method-intf>Home</method-intf>
>         <method-name>*</method-name>
>       </method>
>       <trans-attribute>Required</trans-attribute>
>     </container-transaction>
>   </assembly-descriptor>
> </ejb-jar>
> openejb-jar.xml
> <?xml version="1.0" encoding="UTF-8"?>
> <openejb-jar
>     xmlns="http://www.openejb.org/xml/ns/openejb-jar"
>     xmlns:naming="http://geronimo.apache.org/xml/ns/naming"
>     xmlns:security="http://geronimo.apache.org/xml/ns/security"
>     xmlns:sys="http://geronimo.apache.org/xml/ns/deployment"
>     configId="ProductEJB"
>     parentId="org/apache/geronimo/SystemDatabase">
> <cmp-connection-factory>
>      <resource-link>SystemDatasource</resource-link>
>      <!-- <name>SystemDatasource</name> -->
> </cmp-connection-factory>
> <enterprise-beans>
>     <entity>
>         <ejb-name>Product</ejb-name>
>         <jndi-name>ProductRemote</jndi-name>
>         <local-jndi-name>ProductLocal</local-jndi-name>      
>         <table-name>PRODUCTS</table-name>
>     <cmp-field-mapping>
>         <cmp-field-name>productID</cmp-field-name>
>         <table-column>PRODUCTID</table-column>
>     </cmp-field-mapping>
>     <cmp-field-mapping>
>         <cmp-field-name>name</cmp-field-name>
>         <table-column>NAME</table-column>
>         </cmp-field-mapping>
>     <cmp-field-mapping>
>         <cmp-field-name>basePrice</cmp-field-name>
>         <table-column>BASEPRICE</table-column>
>         </cmp-field-mapping>
>     <cmp-field-mapping>
>         <cmp-field-name>description</cmp-field-name>
>         <table-column>DESCRIPTION</table-column>
>         </cmp-field-mapping>       
>        
>     </entity>
> </enterprise-beans>
> </openejb-jar>
> While i was debugging I saw a method
> public IdentityTransform getPrimaryKeyTransform(Entity entity) in the class IdentityDefinerBuilder.
Here based on size of pkFields the SimplePKTransform or CompoundPKTransform class is selected.
> In the case of a custom class with 1 field also the SimplePKTransform is selected.
> Is this how it should behave? Could you give a general idea of how the primary key values
are taken from the Custom classes in OpenEJB?
> Thanks
> Manu

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Mime
View raw message