geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Aaron Mulder" <ammul...@alumni.princeton.edu>
Subject Re: FindByPrimaryKey
Date Wed, 05 Apr 2006 04:32:47 GMT
Hmmm, nothing stands out to me here.  You might try removing any
whitespace from the prim-key-class values (it looks like there was an
extra space at the end) to see if that makes a difference.  Otherwise
perhaps one of the folks more up to speed on OpenEJB can look at the
stack trace and see what they think.

Thanks,
    Aaron

On 4/4/06, Olivier Voutat <olivier.voutat@gmail.com> wrote:
> <?xml version="1.0" encoding="UTF-8"?>
> <openejb-jar
> xmlns="http://www.openejb.org/xml/ns/openejb-jar-2.0"
> xmlns:nam=" http://geronimo.apache.org/xml/ns/naming-1.0"
> xmlns:pkgen="http://www.openejb.org/xml/ns/pkgen-2.0 "
> xmlns:sec="http://geronimo.apache.org/xml/ns/security-1.1"
> xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.0
> " configId="Locadora/Locadora">
>     <cmp-connection-factory>
>         <resource-link>Fire</resource-link>
>     </cmp-connection-factory>
>
>     <enterprise-beans>
>     <entity>
>          <ejb-name>Cliente</ejb-name>
>         <jndi-name>Cliente</jndi-name>
>         <local-jndi-name>Cliente</local-jndi-name>
>         <table-name>CLIENTES</table-name>
>
>         <cmp-field-mapping>
>             <cmp-field-name>clienteId</cmp-field-name>
>             <table-column>CLIENTEID</table-column>
>         </cmp-field-mapping>
>          <cmp-field-mapping>
>             <cmp-field-name>nome</cmp-field-name>
>             <table-column>NOME</table-column>
>         </cmp-field-mapping>
>         <cmp-field-mapping>
>             <cmp-field-name>endereco</cmp-field-name>
>             <table-column>ENDERECO</table-column>
>         </cmp-field-mapping>
>         <cmp-field-mapping>
>             <cmp-field-name>telefone</cmp-field-name>
>             <table-column>TELEFONE</table-column>
>         </cmp-field-mapping>
>         <cmp-field-mapping>
>             <cmp-field-name>cpf</cmp-field-name>
>             <table-column>CPF</table-column>
>         </cmp-field-mapping>
>         <resource-ref>
>             <ref-name>Fire</ref-name>
>             <resource-link>Fire</resource-link>
>         </resource-ref>
>     </entity>
>
>     <entity>
>          <ejb-name>Carro</ejb-name>
>         <jndi-name>Carro</jndi-name>
>         <local-jndi-name>Carro</local-jndi-name>
>         <table-name>CARROS</table-name>
>
>         <cmp-field-mapping>
>             <cmp-field-name>chassi</cmp-field-name>
>             <table-column>CHASSI</table-column>
>         </cmp-field-mapping>
>         <cmp-field-mapping>
>             <cmp-field-name>marca</cmp-field-name>
>             <table-column>MARCA</table-column>
>         </cmp-field-mapping>
>         <cmp-field-mapping>
>             <cmp-field-name>modelo</cmp-field-name>
>             <table-column>MODELO</table-column>
>         </cmp-field-mapping>
>         <cmp-field-mapping>
>             <cmp-field-name>placa</cmp-field-name>
>             <table-column>PLACA</table-column>
>         </cmp-field-mapping>
>         <cmp-field-mapping>
>             <cmp-field-name>quilometragem</cmp-field-name>
>             <table-column>QUILOMETRAGEM</table-column>
>         </cmp-field-mapping>
>         <cmp-field-mapping>
>             <cmp-field-name>cor</cmp-field-name>
>             <table-column>COR</table-column>
>         </cmp-field-mapping>
>         <cmp-field-mapping>
>             <cmp-field-name>situacao</cmp-field-name>
>             <table-column>SITUACAO</table-column>
>         </cmp-field-mapping>
>         <cmp-field-mapping>
>             <cmp-field-name>tipo</cmp-field-name>
>             <table-column>TIPO</table-column>
>         </cmp-field-mapping>
>         <cmp-field-mapping>
>             <cmp-field-name>diaria</cmp-field-name>
>             <table-column>DIARIA</table-column>
>         </cmp-field-mapping>
>         <resource-ref>
>             <ref-name>Fire</ref-name>
>             <resource-link>Fire</resource-link>
>         </resource-ref>
>     </entity>
>
>     <entity>
>          <ejb-name>Locacao</ejb-name>
>         <jndi-name>Locacao</jndi-name>
>         <local-jndi-name>Locacao</local-jndi-name>
>         <table-name>LOCACOES</table-name>
>
>         <cmp-field-mapping>
>             <cmp-field-name>locacaoId</cmp-field-name>
>             <table-column>LOCACAOID</table-column>
>         </cmp-field-mapping>
>         <cmp-field-mapping>
>             <cmp-field-name>chassi</cmp-field-name>
>             <table-column>CHASSI</table-column>
>         </cmp-field-mapping>
>         <cmp-field-mapping>
>             <cmp-field-name>clienteId</cmp-field-name>
>             <table-column>CLIENTEID</table-column>
>         </cmp-field-mapping>
>         <cmp-field-mapping>
>             <cmp-field-name>dataInicio</cmp-field-name>
>             <table-column>DATAINICIO</table-column>
>         </cmp-field-mapping>
>         <cmp-field-mapping>
>             <cmp-field-name>dataFim</cmp-field-name>
>             <table-column>DATAFIM</table-column>
>         </cmp-field-mapping>
>         <cmp-field-mapping>
>             <cmp-field-name>valor</cmp-field-name>
>             <table-column>VALOR</table-column>
>         </cmp-field-mapping>
>         <cmp-field-mapping>
>
> <cmp-field-name>quilometragemRodada</cmp-field-name>
>
> <table-column>QUILOMETRAGEMRODADA</table-column>
>         </cmp-field-mapping>
>         <resource-ref>
>             <ref-name>Fire</ref-name>
>             <resource-link>Fire</resource-link>
>         </resource-ref>
>     </entity>
>     </enterprise-beans>
>
> </openejb-jar>
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <ejb-jar id="ejb-jar_1" xmlns=" http://java.sun.com/xml/ns/j2ee"
> 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"
> version="2.1">
>
>     <display-name>LocadoraLoccar</display-name>
>
>     <enterprise-beans>
>     <session>
>           <ejb-name>MySession</ejb-name>
>         <home>br.cefetrn.olivier.session.MySessionHome
> </home>
>
> <remote>br.cefetrn.olivier.session.MySession</remote>
>
> <ejb-class>br.cefetrn.olivier.session.MySessionBean</ejb-class>
>         <session-type>Stateful</session-type>
>         <transaction-type>Container</transaction-type>
>         <ejb-local-ref>
>              <ejb-ref-name>ejb/Cliente</ejb-ref-name>
>              <ejb-ref-type>Entity</ejb-ref-type>
>
> <local-home>br.cefetrn.olivier.entity.ClienteLocalHome</local-home>
>
> <local>br.cefetrn.olivier.entity.ClienteLocal</local>
>              <ejb-link>Cliente</ejb-link>
>          </ejb-local-ref>
>         <ejb-local-ref>
>              <ejb-ref-name>ejb/Carro</ejb-ref-name>
>              <ejb-ref-type>Entity</ejb-ref-type>
>              <local-home>
> br.cefetrn.olivier.entity.CarroLocalHome</local-home>
>
> <local>br.cefetrn.olivier.entity.CarroLocal</local>
>              <ejb-link>Carro</ejb-link>
>          </ejb-local-ref>
>         <ejb-local-ref>
>              <ejb-ref-name>ejb/Locacao</ejb-ref-name>
>              <ejb-ref-type>Entity</ejb-ref-type>
>
> <local-home>br.cefetrn.olivier.entity.LocacaoLocalHome
> </local-home>
>
> <local>br.cefetrn.olivier.entity.LocacaoLocal</local>
>              <ejb-link>Locacao</ejb-link>
>          </ejb-local-ref>
>     </session>
>      <entity>
>         <ejb-name>Cliente</ejb-name>
>
> <local-home>br.cefetrn.olivier.entity.ClienteLocalHome</local-home>
>         <local>br.cefetrn.olivier.entity.ClienteLocal
> </local>
>
> <ejb-class>br.cefetrn.olivier.entity.ClienteBean</ejb-class>
>
>         <persistence-type>Container</persistence-type>
>         <prim-key-class>br.cefetrn.olivier.entity.ClientePK
> </prim-key-class>
>
>         <reentrant>false</reentrant>
>         <cmp-version>2.x</cmp-version>
>
> <abstract-schema-name>CLIENTES</abstract-schema-name>
>
> <cmp-field><field-name>clienteId</field-name></cmp-field>
>
> <cmp-field><field-name>nome</field-name></cmp-field>
>
> <cmp-field><field-name>endereco</field-name></cmp-field>
>
> <cmp-field><field-name>telefone</field-name></cmp-field>
>         <cmp-field><field-name>cpf</field-name></cmp-field>
>
>         <resource-ref>
>             <res-ref-name>Fire</res-ref-name>
>                <res-type>javax.sql.DataSource </res-type>
>                <res-auth>Container</res-auth>
>
> <res-sharing-scope>Shareable</res-sharing-scope>
>         </resource-ref>
>         <query>
>             <query-method>
>                 <method-name>findByNome</method-name>
>                 <method-params>
>                     <method-param>java.lang.String</method-param>
>                 </method-params>
>             </query-method>
>             <ejb-ql>
>                 SELECT DISTINCT OBJECT(c) FROM CLIENTES c WHERE c.nome = ?1
>             </ejb-ql>
>         </query>
>         <query>
>             <query-method>
>                 <method-name>findByCpf</method-name>
>                 <method-params>
>                     <method-param>java.lang.String</method-param>
>                 </method-params>
>             </query-method>
>             <ejb-ql>
>                 SELECT DISTINCT OBJECT(c) FROM CLIENTES c WHERE c.cpf = ?1
>             </ejb-ql>
>          </query>
>         <query>
>             <query-method>
>                 <method-name>findAllClientes</method-name>
>                 <method-params>
>                 </method-params>
>             </query-method>
>             <ejb-ql>
>                 SELECT DISTINCT OBJECT(c) FROM CLIENTES c WHERE c.nome IS
> NOT NULL
>             </ejb-ql>
>         </query>
>     </entity>
>     <entity>
>         <ejb-name>Carro</ejb-name>
>
> <local-home>br.cefetrn.olivier.entity.CarroLocalHome</local-home>
>         <local>br.cefetrn.olivier.entity.CarroLocal
> </local>
>
> <ejb-class>br.cefetrn.olivier.entity.CarroBean</ejb-class>
>
>         <persistence-type>Container</persistence-type>
>         <prim-key-class>br.cefetrn.olivier.entity.CarroPK
> </prim-key-class>
>
>         <reentrant>false</reentrant>
>         <cmp-version>2.x</cmp-version>
>         <abstract-schema-name>CARROS</abstract-schema-name>
>
>
> <cmp-field><field-name>chassi</field-name></cmp-field>
>
> <cmp-field><field-name>marca</field-name></cmp-field>
>
> <cmp-field><field-name>modelo</field-name></cmp-field>
>
> <cmp-field><field-name>placa</field-name></cmp-field>
>
> <cmp-field><field-name>quilometragem</field-name></cmp-field>
>         <cmp-field><field-name>cor</field-name></cmp-field>
>
> <cmp-field><field-name>situacao</field-name></cmp-field>
>
> <cmp-field><field-name>tipo</field-name></cmp-field>
>
> <cmp-field><field-name>diaria</field-name></cmp-field>
>
>         <resource-ref>
>             <res-ref-name>Fire</res-ref-name>
>                <res-type>javax.sql.DataSource</res-type>
>                <res-auth>Container</res-auth>
>
> <res-sharing-scope>Shareable</res-sharing-scope>
>         </resource-ref>
>         <query>
>             <query-method>
>                 <method-name>findByMarca</method-name>
>                 <method-params>
>                     <method-param>java.lang.String </method-param>
>                 </method-params>
>             </query-method>
>             <ejb-ql>
>                 SELECT DISTINCT OBJECT(c) FROM CARROS c WHERE c.marca = ?1
>             </ejb-ql>
>         </query>
>         <query>
>             <query-method>
>                 <method-name>findByModelo</method-name>
>                 <method-params>
>                     <method-param> java.lang.String</method-param>
>                 </method-params>
>             </query-method>
>             <ejb-ql>
>                 SELECT DISTINCT OBJECT(c) FROM CARROS c WHERE c.modelo = ?1
>             </ejb-ql>
>         </query>
>         <query>
>             <query-method>
>                 <method-name>findBySituacao</method-name>
>                 <method-params>
>                     <method-param>java.lang.String</method-param>
>                 </method-params>
>             </query-method>
>             <ejb-ql>
>                 SELECT DISTINCT OBJECT(c) FROM CARROS c WHERE c.situacao =
> ?1
>             </ejb-ql>
>         </query>
>     </entity>
>     <entity>
>         <ejb-name>Locacao</ejb-name>
>
> <local-home>br.cefetrn.olivier.entity.LocacaoLocalHome
> </local-home>
>
> <local>br.cefetrn.olivier.entity.LocacaoLocal</local>
>
> <ejb-class>br.cefetrn.olivier.entity.LocacaoBean</ejb-class>
>
>         <persistence-type>Container</persistence-type>
>
> <prim-key-class>br.cefetrn.olivier.entity.LocacaoPK</prim-key-class>
>
>         <reentrant>false</reentrant>
>         <cmp-version>2.x</cmp-version>
>
> <abstract-schema-name>LOCACOES</abstract-schema-name>
>
> <cmp-field><field-name>locacaoId</field-name></cmp-field>
>
>
> <cmp-field><field-name>chassi</field-name></cmp-field>
>
> <cmp-field><field-name>clienteId</field-name></cmp-field>
>
> <cmp-field><field-name>dataInicio</field-name></cmp-field>
>
> <cmp-field><field-name>dataFim</field-name></cmp-field>
>
> <cmp-field><field-name>valor</field-name></cmp-field>
>
> <cmp-field><field-name>quilometragemRodada</field-name></cmp-field>
>
>         <resource-ref>
>             <res-ref-name>Fire</res-ref-name>
>                <res-type> javax.sql.DataSource</res-type>
>                <res-auth>Container</res-auth>
>
> <res-sharing-scope>Shareable</res-sharing-scope>
>         </resource-ref>
>         <query>
>             <query-method>
>                 <method-name>findByChassi</method-name>
>                 <method-params>
>                     <method-param>java.lang.String</method-param>
>                 </method-params>
>             </query-method>
>             <ejb-ql>
>                 SELECT DISTINCT OBJECT(l) FROM LOCACOES l WHERE l.chassi =
> ?1
>             </ejb-ql>
>         </query>
>         <query>
>             <query-method>
>                 <method-name>findByClienteId</method-name>
>                 <method-params>
>                     <method-param> java.lang.Integer</method-param>
>                 </method-params>
>             </query-method>
>             <ejb-ql>
>                 SELECT DISTINCT OBJECT(l) FROM LOCACOES l WHERE l.clienteId
> = ?1
>             </ejb-ql>
>         </query>
>     </entity>
>     </enterprise-beans>
>      <!--
>        To add session beans that you have deployment descriptor info for,
> add
>        a file to your XDoclet merge directory called session-beans.xml that
> contains
>        the <session></session> markup for those beans.
>      -->
>
>       <!-- Entity Beans -->
>      <!--
>        To add entity beans that you have deployment descriptor info for, add
>        a file to your XDoclet merge directory called entity-beans.xml that
> contains
>        the <entity></entity> markup for those beans.
>      -->
>
>       <!-- Message Driven Beans -->
>       <!--
>        To add message driven beans that you have deployment descriptor info
> for, add
>        a file to your XDoclet merge directory called
> message-driven-beans.xml that contains
>        the <message-driven></message-driven> markup for
> those beans.
>      -->
>
>
>    <!-- Relationships -->
>
>    <!-- Assembly Descriptor -->
>      <!--
>        To specify your own assembly descriptor info here, add a file to your
>        XDoclet merge directory called assembly-descriptor.xml that contains
>        the <assembly-descriptor></assembly-descriptor>
> markup.
>      -->
>
>    <assembly-descriptor id="AssemblyDescriptor_1">
>      <!--
>         To specify additional security-role elements, add a file in the
> merge
>        directory called ejb-security-roles.xml that contains them.
>      -->
>
>    <!-- method permissions -->
>      <!--
>        To specify additional method-permission elements, add a file in the
> merge
>        directory called ejb-method-permissions.ent that contains them.
>      -->
>
>    <!-- transactions -->
>      <!--
>        To specify additional container-transaction elements, add a file in
> the merge
>        directory called ejb-container-transactions.ent that contains them.
>      -->
>
>    <!-- finder transactions -->
>
>    <!-- message destinations -->
>      <!--
>        To specify additional message-destination elements, add a file in the
> merge
>        directory called ejb-message-destinations.ent that contains them.
>      -->
>
>    <!-- exclude list -->
>      <!--
>        To specify an exclude-list element, add a file in the merge directory
>        called ejb-exclude-list.xml that contains it.
>      -->
>     </assembly-descriptor>
>
> </ejb-jar>
>
>
>
> On 4/5/06, Aaron Mulder <ammulder@alumni.princeton.edu > wrote:
> > Can you attach your original ejb-jar.xml and openejb-jar.xml to an
> > e-mail?  We need to figure out why it's getting mixed up between
> > String and the PK class for the primary key for your bean.
> >
> > Thanks,
> >     Aaron
> >
> > On 4/4/06, Olivier Voutat < olivier.voutat@gmail.com> wrote:
> > > Well, I added the set/get chassi in my CarPK class but no luck...
> > >
> > > I did another test too. The primary key returned by the method
> getPrimaryKey
> > > of the returned object when I do findBySituation (which was implemented
> by
> > > me) is an instance of String, not o CarPK like you can see here...don't
> get
> > > why
> > >
> > > Primary Key 3687352196865265
> > > String Instance true
> > > CarPK Instance false
> > > Primary Key 65436549663416546
> > > String Instance true
> > > CarPK Instance false
> > > Primary Key 65454894635418697
> > > String Instance true
> > > CarPK Instance false
> > > Primary Key 9BWCA05X85P082824
> > > String Instance true
> > > CarPK Instance false
> > > Primary Key AABB151515
> > > String Instance true
> > > CarPK Instance false
> > > New pk class AABB151515
> > > Until here everything works.
> > > setEntityContext called do carro.
> > > setEntityContext called do carro.
> > > 23:58:30,665 WARN  [SystemExceptionInterceptor] Carro
> > > javax.ejb.TransactionRolledbackLocalException
> > >         at
> > >
> org.openejb.transaction.ContainerPolicy$TxRequired.invoke
> > > (ContainerPolicy.java:123)
> > >         at
> > >
> org.openejb.transaction.TransactionContextInterceptor.invoke(TransactionContextInterceptor.java:80)
> > >         at
> > > org.openejb.SystemExceptionInterceptor.invoke
> (SystemExceptionInterceptor.java
> > > :82)
> > >         at
> > >
> org.openejb.GenericEJBContainer.invoke(GenericEJBContainer.java:238)
> > >         at
> > >
> org.openejb.proxy.EJBMethodInterceptor.intercept(EJBMethodInterceptor.java
> :129)
> > >         at
> > >
> org.openejb.proxy.EntityEJBLocalHome$$EnhancerByCGLIB$$1847bc60.findByPrimaryKey
> > > (<generated>)
> > >         at
> > >
> br.cefetrn.olivier.session.MySessionBean.registrarLocacao
> (MySessionBean.java:71)
> > >         at
> > >
> br.cefetrn.olivier.session.MySessionBean$$FastClassByCGLIB$$fba7f7a3.invoke(<generated>)
> > >         at
> > > org.openejb.dispatch.AbstractMethodOperation.invoke
> (AbstractMethodOperation.java:90)
> > >         at
> > >
> org.openejb.sfsb.BusinessMethod.execute(BusinessMethod.java:66)
> > >         at
> org.openejb.dispatch.DispatchInterceptor.invoke
> > > (DispatchInterceptor.java :72)
> > >         at
> > >
> org.apache.geronimo.naming.java.ComponentContextInterceptor.invoke(ComponentContextInterceptor.java:56)
> > >         at
> > >
> org.openejb.ConnectionTrackingInterceptor.invoke(ConnectionTrackingInterceptor.java
> > > :81)
> > >         at
> > >
> org.openejb.sfsb.StatefulInstanceInterceptor.invoke(StatefulInstanceInterceptor.java:115)
> > >         at
> > >
> org.openejb.transaction.ContainerPolicy$TxRequired.invoke(ContainerPolicy.java
> :140)
> > >         at
> > >
> org.openejb.transaction.TransactionContextInterceptor.invoke(TransactionContextInterceptor.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.doEjbObject_BUSINESS_METHOD(EjbRequestHandler.java
> > > :325)
> > >         at
> > >
> org.openejb.server.ejbd.EjbRequestHandler.processRequest(EjbRequestHandler.java
> :196)
> > >         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$$463425f3.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(Thread.java:595)
> > > Caused by: java.lang.ClassCastException :
> > > br.cefetrn.olivier.entity.CarroPK
> > >         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:66)
> > >         at
> > > org.openejb.entity.cmp.CMPFinder.execute(CMPFinder.java
> :99)
> > >         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(ComponentContextInterceptor.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:119)
> > >         ... 36 more
> > > 23:58:30,670 WARN  [SystemExceptionInterceptor]
> MySession
> > > javax.ejb.TransactionRolledbackLocalException
> > >         at
> > >
> org.openejb.transaction.ContainerPolicy$TxRequired.invoke(ContainerPolicy.java:123)
> > >         at
> > >
> org.openejb.transaction.TransactionContextInterceptor.invoke
> > > (TransactionContextInterceptor.java :80)
> > >         at
> > >
> org.openejb.SystemExceptionInterceptor.invoke(SystemExceptionInterceptor.java:82)
> > >         at
> > >
> org.openejb.GenericEJBContainer.invoke(GenericEJBContainer.java:238)
> > >          at
> > >
> org.openejb.proxy.EJBMethodInterceptor.intercept(EJBMethodInterceptor.java:129)
> > >         at
> > >
> org.openejb.proxy.EntityEJBLocalHome$$EnhancerByCGLIB$$1847bc60.findByPrimaryKey(<generated>)
> > >         at
> > >
> br.cefetrn.olivier.session.MySessionBean.registrarLocacao
> > > (MySessionBean.java:71)
> > >         at
> > >
> br.cefetrn.olivier.session.MySessionBean$$FastClassByCGLIB$$fba7f7a3.invoke(<generated>)
> > >         at
> > >
> org.openejb.dispatch.AbstractMethodOperation.invoke(AbstractMethodOperation.java
> > > :90)
> > >         at
> > >
> org.openejb.sfsb.BusinessMethod.execute(BusinessMethod.java:66)
> > >         at
> > >
> org.openejb.dispatch.DispatchInterceptor.invoke(DispatchInterceptor.java:72)
> > >         at
> > >
> org.apache.geronimo.naming.java.ComponentContextInterceptor.invoke
> > > (ComponentContextInterceptor.java :56)
> > >         at
> > >
> org.openejb.ConnectionTrackingInterceptor.invoke(ConnectionTrackingInterceptor.java:81)
> > >         at
> > >
> org.openejb.sfsb.StatefulInstanceInterceptor.invoke(StatefulInstanceInterceptor.java
> > > :115)
> > >         at
> > >
> org.openejb.transaction.ContainerPolicy$TxRequired.invoke(ContainerPolicy.java:140)
> > >         at
> > >
> org.openejb.transaction.TransactionContextInterceptor.invoke(TransactionContextInterceptor.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.doEjbObject_BUSINESS_METHOD(EjbRequestHandler.java:325)
> > >         at
> > >
> org.openejb.server.ejbd.EjbRequestHandler.processRequest(EjbRequestHandler.java
> > > :196)
> > >         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$$463425f3.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(Thread.java:595)
> > > Caused by: java.lang.ClassCastException:
> > > br.cefetrn.olivier.entity.CarroPK
> > >         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:66)
> > >         at
> > >
> org.openejb.entity.cmp.CMPFinder.execute(CMPFinder.java:99)
> > >         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(ComponentContextInterceptor.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 :119)
> > >         ... 36 more
> > > 23:58:30,688 WARN  [[Negocio]] Servlet.service() for servlet Negocio
> threw
> > > exception
> > > java.rmi.RemoteException: The bean encountered a non-application
> exception.
> > > method; nested exception is:
> > >         javax.ejb.TransactionRolledbackLocalException
> > >         at
> > >
> org.openejb.server.ejbd.EjbRequestHandler.invoke(EjbRequestHandler.java:303)
> > >         at
> > >
> org.openejb.server.ejbd.EjbRequestHandler.doEjbObject_BUSINESS_METHOD
> > > (EjbRequestHandler.java:325)
> > >         at
> > >
> org.openejb.server.ejbd.EjbRequestHandler.processRequest(EjbRequestHandler.java:196)
> > >         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$$463425f3.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(Thread.java:595)
> > > Caused by:
> javax.ejb.TransactionRolledbackLocalException
> > >         at
> > >
> org.openejb.transaction.ContainerPolicy$TxRequired.invoke(ContainerPolicy.java:123)
> > >         at
> > >
> org.openejb.transaction.TransactionContextInterceptor.invoke
> > > (TransactionContextInterceptor.java :80)
> > >         at
> > >
> org.openejb.SystemExceptionInterceptor.invoke(SystemExceptionInterceptor.java:82)
> > >         at
> > >
> org.openejb.GenericEJBContainer.invoke(GenericEJBContainer.java:238)
> > >          at
> > >
> org.openejb.proxy.EJBMethodInterceptor.intercept(EJBMethodInterceptor.java:129)
> > >         at
> > >
> org.openejb.proxy.EntityEJBLocalHome$$EnhancerByCGLIB$$1847bc60.findByPrimaryKey(<generated>)
> > >         at
> > >
> br.cefetrn.olivier.session.MySessionBean.registrarLocacao
> > > (MySessionBean.java:71)
> > >         at
> > >
> br.cefetrn.olivier.session.MySessionBean$$FastClassByCGLIB$$fba7f7a3.invoke(<generated>)
> > >         at
> > >
> org.openejb.dispatch.AbstractMethodOperation.invoke(AbstractMethodOperation.java
> > > :90)
> > >         at
> > >
> org.openejb.sfsb.BusinessMethod.execute(BusinessMethod.java:66)
> > >         at
> > >
> org.openejb.dispatch.DispatchInterceptor.invoke(DispatchInterceptor.java:72)
> > >         at
> > >
> org.apache.geronimo.naming.java.ComponentContextInterceptor.invoke
> > > (ComponentContextInterceptor.java :56)
> > >         at
> > >
> org.openejb.ConnectionTrackingInterceptor.invoke(ConnectionTrackingInterceptor.java:81)
> > >         at
> > >
> org.openejb.sfsb.StatefulInstanceInterceptor.invoke(StatefulInstanceInterceptor.java
> > > :115)
> > >         at
> > >
> org.openejb.transaction.ContainerPolicy$TxRequired.invoke(ContainerPolicy.java:140)
> > >         at
> > >
> org.openejb.transaction.TransactionContextInterceptor.invoke(TransactionContextInterceptor.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)
> > >         ... 18 more
> > > Caused by: java.lang.ClassCastException:
> > > br.cefetrn.olivier.entity.CarroPK
> > >         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:66)
> > >         at
> > >
> org.openejb.entity.cmp.CMPFinder.execute(CMPFinder.java:99)
> > >         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
> > > (ComponentContextInterceptor.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
> :119)
> > >         ... 36 more
> > >
> > >
> > > On 4/4/06, Aaron Mulder <ammulder@alumni.princeton.edu> wrote:
> > > >
> > >  What's the actual problem?  When you call findByPrimaryKey, is it
> > > returning nothing, or giving you a stack trace, or what?
> > >
> > > I think your primary key class is supposed to have getters and setters
> > > for all the properties, with names matching the primary key fields on
> > > the bean.  So it may be that you need a getChassi and setChassi on the
> > > PK class to get it working.
> > >
> > > Thanks,
> > >     Aaron
> > >
> > > P.S. Ever played Car Wars?  :)
> > >
> > > On 4/4/06, Olivier Voutat < olivier.voutat@gmail.com> wrote:
> > > > I'm in trouble (again lol) with the findByPrimaryKey method.
> > > >
> > > > CarLocalHome localHomeCar = Locator.getCarLocalHome ();
> > > > CarLocal tempcar = null;
> > > > try {
> > > >             Iterator temp =
> > > > localHomeCar.findBySituation("Avaliable").iterator();
> > > >             CarPK pk = new CarPK();
> > > >             while (temp.hasNext()) {
> > > >                 tempcar = (CarLocal)temp.next();
> > > >                 System.out.println("Primary Key " +
> > > > tempcar.getPrimaryKey ().toString());
> > > >                 pk =
> (CarroPK)tempcar.getPrimaryKey();
> > > > }
> > > > System.out.println(pk.chassi );
> > > > System.out.println("Everything works fine until here.");
> > > >
> > > >  CarLocal mycar = localHomeCar.findByPrimaryKey(new
> CarPK("CHASSSICODE");
> > > > //HERE I don't get to pick my ejbLocalObjet by the primary key.
> > > >
> > > > CarLocal mycar = localHomeCar.findByPrimaryKey(pk);
> > > > //Tried this way too but no success
> > > >
> > >
> -------------------------------------------------------------------------------------------------------------------------------
> > > > // This is my CarPK class
> > > > package br.cefetrn.olivier.entity;
> > > >
> > > > import java.io.Serializable;
> > > >
> > > > public class CarPK implements Serializable {
> > > >
> > > >     private static final long serialVersionUID = 1L;
> > > >     public String chassi;
> > > >
> > > >     public CarroPK() {}
> > > >
> > > >     public CarroPK(String chas) {
> > > >         this.chassi = chas;
> > > >     }
> > > >
> > > >     public String toString() {
> > > >         return chassi.toString();
> > > >     }
> > > >
> > > >     public int hashCode() {
> > > >         return chassi.hashCode();
> > > >     }
> > > >
> > > >     public boolean equals(Object car) {
> > > >         return ((CarroPK)car).chassi.equals(chassi);
> > > >     }
> > > > }
> > > >
> > >
> -------------------------------------------------------------------------------------------------------------------------------
> > > > // This is my ejb-jar.xml code
> > > >     <entity>
> > > >         <ejb-name>Car</ejb-name>
> > > >
> > > >
> > > <local-home>br.cefetrn.olivier.entity.CarLocalHome
> </local-home>
> > > >         <local>br.cefetrn.olivier.entity.CarLocal
> > > </local>
> > > >
> > > >
> <ejb-class>br.cefetrn.olivier.entity.CarBean</ejb-class>
> > > >
> <persistence-type>Container</persistence-type>
> > > >         <prim-key-class>br.cefetrn.olivier.entity.CarPK
> </prim-key-class>
> > > >     /////////////My PK class
> > > >         <reentrant>false</reentrant>
> > > >         <cmp-version> 2.x</cmp-version>
> > > >
> <abstract-schema-name>CARS</abstract-schema-name>
> > > >
> > > >
> <cmp-field><field-name>chassi</field-name></cmp-field>
> > > >
> > > >
> > >
> <cmp-field><field-name>manufacturer</field-name></cmp-field>
> > > >
> > > > <cmp-field><field-name>model</field-name></cmp-field>
> > > >
> > > >
> <cmp-field><field-name>plaque</field-name></cmp-field>
> > > >
> > > <cmp-field><field-name>km</field-name></cmp-field>
> > > >
> > > > <cmp-field><field-name>color</field-name></cmp-field>
> > > >
> > > >
> <cmp-field><field-name>situation</field-name></cmp-field>
> > > >
> > > > <cmp-field><field-name>type</field-name></cmp-field>
> > > >
> > > > <cmp-field><field-name>price</field-name></cmp-field>
> > > >         <resource-ref>
> > > >             <res-ref-name>Fire</res-ref-name>
> > > >                <res-type> javax.sql.DataSource</res-type>
> > > >                <res-auth>Container</res-auth>
> > > >
> > > > <res-sharing-scope>Shareable</res-sharing-scope>
> > > >         </resource-ref>
> > > >     </entity>
> > > >
> > > > Does anyone knows what I'm doing wrong in this findByPrimaryKey ?
> > > > Best Regards,
> > > > --
> > > > Olivier Voutat
> > > > Rua Praia de Muri�, 9188
> > >
> > > > Cep 59092-390 / Natal - RN
> > > > Tel: (84) 3219-0427 Cel: (84) 9977-3917
> > >
> > >
> > >
> > > --
> > > Olivier Jeanpierre Voutat
> > > Rua Praia de Muri�, 9188
> > >
> > > Cep 59092-390 / Natal - RN
> > > Tel: (84) 3219-0427 Cel: (84) 9977-3917
> >
>
>
>
> --
> Olivier Jeanpierre Voutat
> Rua Praia de Muriú, 9188
>
> Cep 59092-390 / Natal - RN
> Tel: (84) 3219-0427 Cel: (84) 9977-3917
Mime
View raw message