0 Replies Latest reply on May 4, 2005 11:31 PM by Jairo Gutierrez

    Lomboz JBoss Oracle 8i

    Jairo Gutierrez Newbie

      My Exception is in the mapping of a number(5) in Oracle 8i, first to Short and second to Integer. The Mapping is the next:

      <j2ee:display-name>Usuario</j2ee:display-name>
      <j2ee:ejb-name>UsuarioBean</j2ee:ejb-name>
      <j2ee:ejb-class>beans.cmp.UsuarioBean</j2ee:ejb-class>
      <j2ee:persistence-type>Container</j2ee:persistence-type>
      <j2ee:prim-key-class>java.lang.Integer</j2ee:prim-key-class>
      <j2ee:cmp-version>2.x</j2ee:cmp-version>
      <j2ee:abstract-schema-name>esquemaUsuario</j2ee:abstract-schema-name>
      <j2ee:primkey-field>identificacion</j2ee:primkey-field>
      </lomboz:entityEjb>
      <lomboz:fieldMappings>
      <lomboz:fieldName>nombre</lomboz:fieldName>
      <lomboz:fieldType>java.lang.String</lomboz:fieldType>
      <lomboz:columnName>Nombre</lomboz:columnName>
      <lomboz:jdbcType>VARCHAR</lomboz:jdbcType>
      <lomboz:sqlType>VARCHAR2</lomboz:sqlType>
      <lomboz:readOnly>false</lomboz:readOnly>
      <lomboz:primaryKey>false</lomboz:primaryKey>
      </lomboz:fieldMappings>
      <lomboz:fieldMappings>
      <lomboz:fieldName>apellido</lomboz:fieldName>
      <lomboz:fieldType>java.lang.String</lomboz:fieldType>
      <lomboz:columnName>Apellido</lomboz:columnName>
      <lomboz:jdbcType>VARCHAR</lomboz:jdbcType>
      <lomboz:sqlType>VARCHAR2</lomboz:sqlType>
      <lomboz:readOnly>false</lomboz:readOnly>
      <lomboz:primaryKey>false</lomboz:primaryKey>
      </lomboz:fieldMappings>
      <lomboz:fieldMappings>
      <lomboz:fieldName>username</lomboz:fieldName>
      <lomboz:fieldType>java.lang.String</lomboz:fieldType>
      <lomboz:columnName>Username</lomboz:columnName>
      <lomboz:jdbcType>VARCHAR</lomboz:jdbcType>
      <lomboz:sqlType>VARCHAR2</lomboz:sqlType>
      <lomboz:readOnly>false</lomboz:readOnly>
      <lomboz:primaryKey>false</lomboz:primaryKey>
      </lomboz:fieldMappings>
      <lomboz:fieldMappings>
      <lomboz:fieldName>password</lomboz:fieldName>
      <lomboz:fieldType>java.lang.String</lomboz:fieldType>
      <lomboz:columnName>Password</lomboz:columnName>
      <lomboz:jdbcType>VARCHAR</lomboz:jdbcType>
      <lomboz:sqlType>VARCHAR2</lomboz:sqlType>
      <lomboz:readOnly>false</lomboz:readOnly>
      <lomboz:primaryKey>false</lomboz:primaryKey>
      </lomboz:fieldMappings>
      <lomboz:fieldMappings>
      <lomboz:fieldName>rol</lomboz:fieldName>
      <lomboz:fieldType>java.lang.String</lomboz:fieldType>
      <lomboz:columnName>Rol</lomboz:columnName>
      <lomboz:jdbcType>VARCHAR</lomboz:jdbcType>
      <lomboz:sqlType>VARCHAR2</lomboz:sqlType>
      <lomboz:readOnly>false</lomboz:readOnly>
      <lomboz:primaryKey>false</lomboz:primaryKey>
      </lomboz:fieldMappings>
      <lomboz:fieldMappings>
      <lomboz:fieldName>identificacion</lomboz:fieldName>
      <lomboz:fieldType>java.lang.Integer</lomboz:fieldType>
      <lomboz:columnName>Identificacion</lomboz:columnName>
      <lomboz:jdbcType>NUMERIC</lomboz:jdbcType>
      <lomboz:sqlType>NUMBER(5)</lomboz:sqlType>
      <lomboz:readOnly>false</lomboz:readOnly>
      <lomboz:primaryKey>true</lomboz:primaryKey>
      </lomboz:fieldMappings>
      <lomboz:tableName>Usuario</lomboz:tableName>
      <lomboz:dataSourceName>jdbc/OracleDS</lomboz:dataSourceName>
      </lomboz:entity>
      </lomboz:EJB>
      <!-- end-lomboz-definition -->
      *
      * <!-- begin-xdoclet-definition -->
      * @ejb.bean name="Usuario"
      * jndi-name="UsuarioBean"
      * type="CMP"
      * primkey-field="identificacion"
      * schema="esquemaUsuario"
      * cmp-version="2.x"
      * data-source="jdbc/OracleDS"
      *
      * @ejb.persistence
      * table-name="Usuario"
      *
      * @ejb.finder
      * query="SELECT OBJECT(a) FROM esquemaUsuario as a"
      * signature="java.util.Collection findAll()"
      *
      * @ejb.finder
      * query="SELECT OBJECT(a) FROM esquemaUsuario a WHERE a.username = ?1 and a.password = ?1"
      * signature="UsuarioData findLogin(java.lang.String Username, java.lang.String password)"

      *
      * @ejb.pk class="java.lang.Integer"
      * <!-- end-xdoclet-definition -->
      * @generated
      **/



      And the StackTrace is this:

      ERROR [Usuario#findByPrimaryKey] Find failed
      java.lang.ClassCastException: java.lang.Integer
      at oracle.jdbc.driver.OraclePreparedStatement.setObject(OraclePreparedStatement.java:2003)
      at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.setObject(WrappedPreparedStatement.java:596)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCParameterSetter$4.setNotNull(JDBCParameterSetter.java:117)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCParameterSetter$JDBCAbstractParameterSetter.set(JDBCParameterSetter.java:56)
      at org.jboss.ejb.plugins.cmp.jdbc.QueryParameter.set(QueryParameter.java:312)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCAbstractQueryCommand.execute(JDBCAbstractQueryCommand.java:202)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCAbstractQueryCommand.execute(JDBCAbstractQueryCommand.java:128)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCFindByPrimaryKeyQuery.execute(JDBCFindByPrimaryKeyQuery.java:128)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCFindEntityCommand.execute(JDBCFindEntityCommand.java:47)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.findEntity(JDBCStoreManager.java:589)
      at org.jboss.ejb.plugins.CMPPersistenceManager.findEntity(CMPPersistenceManager.java:300)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.findEntity(CachedConnectionInterceptor.java:298)
      at org.jboss.ejb.EntityContainer.findSingleObject(EntityContainer.java:1086)
      at org.jboss.ejb.EntityContainer.findLocal(EntityContainer.java:663)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.jboss.invocation.Invocation.performCall(Invocation.java:345)
      at org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome(EntityContainer.java:1113)
      at org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractInterceptor.java:90)
      at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome(EntitySynchronizationInterceptor.java:192)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invokeHome(CachedConnectionInterceptor.java:212)
      at org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractInterceptor.java:90)
      at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInterceptor.java:113)
      at org.jboss.ejb.plugins.EntityLockInterceptor.invokeHome(EntityLockInterceptor.java:61)
      at org.jboss.ejb.plugins.EntityCreationInterceptor.invokeHome(EntityCreationInterceptor.java:28)
      at org.jboss.ejb.plugins.CallValidationInterceptor.invokeHome(CallValidationInterceptor.java:41)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:109)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:316)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:129)
      at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:106)
      at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:120)
      at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invokeHome(ProxyFactoryFinderInterceptor.java:93)
      at org.jboss.ejb.EntityContainer.internalInvokeHome(EntityContainer.java:508)
      at org.jboss.ejb.Container.invoke(Container.java:876)
      at org.jboss.ejb.plugins.local.BaseLocalProxyFactory.invokeHome(BaseLocalProxyFactory.java:342)
      at org.jboss.ejb.plugins.local.LocalHomeProxy.invoke(LocalHomeProxy.java:118)
      at $Proxy136.findByPrimaryKey(Unknown Source)
      at beans.session.LoginBean.login(LoginBean.java:81)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.jboss.invocation.Invocation.performCall(Invocation.java:345)
      at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:214)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:185)
      at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:113)
      at org.jboss.webservice.server.ServiceEndpointInterceptor.invoke(ServiceEndpointInterceptor.java:51)
      at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:48)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:105)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:316)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:149)
      at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:128)
      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
      at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
      at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:624)
      at org.jboss.ejb.Container.invoke(Container.java:854)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:242)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
      at org.jboss.invocation.jrmp.server.JRMPInvoker$MBeanServerAction.invoke(JRMPInvoker.java:775)
      at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:382)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
      at sun.rmi.transport.Transport$1.run(Transport.java:153)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
      at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
      at java.lang.Thread.run(Thread.java:595)

      Thanks for your help...