1 2 Previous Next 20 Replies Latest reply on Jul 11, 2002 4:51 PM by Sureshbabu Thyvalappil

    entity bean mapping to multiple tables

    Sureshbabu Thyvalappil Newbie

      Hi,
      I am trying to deploy a CMP entitybean which maps to columns in 2 different tables.
      The jaws.xml section for the same looks like below:

      <ejb-name>BankAccountBean</ejb-name>

      <table-name>ES_BANK_ACCOUNT,ES_WALLET_ITEM</table-name>
      <create-table>false</create-table>
      <cmp-field>
      <field-name>bankName</field-name>
      <column-name>ES_BANK_ACCOUNT.BANK_NAME</column-name>
      <jdbc-type>VARCHAR</jdbc-type>
      <sql-type>VARCHAR(30)</sql-type>
      </cmp-field>
      <cmp-field>
      <field-name>description</field-name>
      <column-name>ES_WALLET_ITEM.WALLET_DESC</column-name>
      <jdbc-type>VARCHAR</jdbc-type>
      <sql-type>VARCHAR(30)</sql-type>
      </cmp-field>
      .
      .

      etc.

      I get the following error when i run the test client to create the bean.

      [WARN,PreparedStatementFactory] Error creating prepared statement.
      SQL Exception: Syntax error: Encountered "," at line 1, column 28.
      at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:245)

      at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:220)
      at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:122)
      at RmiJdbc.RJConnectionServer_Stub.prepareStatement(Unknown Source)
      at RmiJdbc.RJConnection.prepareStatement(RJConnection.java:109)
      at org.jboss.pool.jdbc.PreparedStatementFactory.createObject(Unknown Source)
      at org.jboss.pool.cache.LeastRecentlyUsedCache.addObject(Unknown Source)
      at org.jboss.pool.cache.LeastRecentlyUsedCache.getObject(Unknown Source)
      at org.jboss.pool.cache.LeastRecentlyUsedCache.useObject(Unknown Source)
      at org.jboss.pool.jdbc.xa.wrapper.XAClientConnection.prepareStatement(Unknown Source)
      at org.jboss.ejb.plugins.jaws.jdbc.JDBCCommand.jdbcExecute(JDBCCommand.java:154)
      at org.jboss.ejb.plugins.jaws.jdbc.JDBCCreateEntityCommand.execute(JDBCCreateEntityCommand.j
      ava:143)
      at org.jboss.ejb.plugins.jaws.JAWSPersistenceManager.createEntity(JAWSPersistenceManager.jav
      a:128)
      at org.jboss.ejb.plugins.CMPPersistenceManager.createEntity(CMPPersistenceManager.java:231)
      at org.jboss.ejb.EntityContainer.createHome(EntityContainer.java:632)
      at java.lang.reflect.Method.invoke(Native Method)
      at org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome(EntityContainer.java:859)
      at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome(EntitySynchronizationIn
      terceptor.java:234)
      at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInterceptor.java
      :147)
      at org.jboss.ejb.plugins.EntityLockInterceptor.invokeHome(EntityLockInterceptor.java:97)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invokeNext(TxInterceptorCMT.java:142)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:347)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:86)
      at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:102)
      at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:103)
      at org.jboss.ejb.EntityContainer.invokeHome(EntityContainer.java:421)
      at org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invokeHome(JRMPContainerInvoker.ja
      va:387)
      at java.lang.reflect.Method.invoke(Native Method)
      at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:241)
      at sun.rmi.transport.Transport$1.run(Transport.java:152)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.rmi.transport.Transport.serviceCall(Transport.java:148)
      at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:465)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:706)
      at java.lang.Thread.run(Thread.java:484)

      ---------------------------------------------------

      It throws error saying not able to prepare sql statement as given above.
      It seems JAWS is unable to take more than one table names in the <table-name> tag.

      Could anyone please help me out how to map one entity bean to multiple tables using JBOSS 2.4.4 with tomcat?
      Thanks in advance.

      Suresh



        1 2 Previous Next