3 Replies Latest reply on Jul 5, 2004 2:00 AM by Alexey Loubyansky

    Relationship mapping in jbosscmp-jdbc.xml (another problem)

    Raj Subramani Newbie

      I am gettinga curious java.rmi.ServerException and I hope you can help.

      A table Tradable_Instrument has symbol (String) and trading_centre_code (String, foreign key) as its compound primary keys.

      Table Trading_Centre has trading_centre_code as its primary key.

      I have defined a one-to-many bidirectional relationship as follows:

      <ejb-relation>
       <ejb-relation-name>TradingCentreEJB - TradableInstrumentEJB</ejb-relation-name>
       <ejb-relationship-role>
       <ejb-relationship-role-name>TradingCentre-has-many-TradableInstruments</ejb-relationship-role-name>
       <multiplicity>One</multiplicity>
       <relationship-role-source>
       <ejb-name>TradingCentreEJB</ejb-name>
       </relationship-role-source>
       <cmr-field>
       <cmr-field-name>localTradableInstrument</cmr-field-name>
       <cmr-field-type>java.util.Collection</cmr-field-type>
       </cmr-field>
       </ejb-relationship-role>
       <ejb-relationship-role>
       <ejb-relationship-role-name>TradableInstrument-belongs-to-a-TradingCentre</ejb-relationship-role-name>
       <multiplicity>Many</multiplicity>
       <relationship-role-source>
       <ejb-name>TradableInstrumentEJB</ejb-name>
       </relationship-role-source>
       <cmr-field>
       <cmr-field-name>localTradingCentre</cmr-field-name>
       </cmr-field>
       </ejb-relationship-role>
       </ejb-relation>
      


      the corresponding jbosscmp-jdbc.xml entry is:

      <ejb-relation>
       <ejb-relation-name>TradingCentreEJB - TradableInstrumentEJB</ejb-relation-name>
       <ejb-relationship-role>
       <ejb-relationship-role-name>TradableInstrument-belongs-to-a-TradingCentre</ejb-relationship-role-name>
       <key-fields/>
       </ejb-relationship-role>
       <ejb-relationship-role>
       <ejb-relationship-role-name>TradingCentre-has-many-TradableInstruments</ejb-relationship-role-name>
       <key-fields>
       <key-field>
       <field-name>trading_centre_code</field-name>
       <column-name>trading_centre_code</column-name>
       </key-field>
       </key-fields>
       </ejb-relationship-role>
       </ejb-relation>
      


      In TradableInstrumentBean, I am implementing:

       public TradingCentre getTradingCentre() throws EJBException
      


      as defined by TradingCentre (the remote) interface as:

      context = new InitialContext();
       ref = context.lookup("TradingCentreEJB");
       tradingCentreHome = (TradingCentreHome) javax.rmi.PortableRemoteObject.narrow(ref, TradingCentreHome.class);
       return tradingCentreHome.findByPrimaryKey(this.getLocalTradingCentre().getTrading_centre_code());
      



      But I keep getting the following error:

      java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
       java.rmi.ServerException: EJBException:; nested exception is:
       javax.ejb.EJBException: Load relation failed; CausedByException is:
       Expected to find "end of SQL command" instead found "." at position 113.
       at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:292)
       at sun.rmi.transport.Transport$1.run(Transport.java:148)
       at java.security.AccessController.doPrivileged(Native Method)
       at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
       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:536)
       at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
       at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
       at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:133)
       at org.jboss.invocation.jrmp.server.JRMPInvoker_Stub.invoke(Unknown Source)
       at org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy.invoke(JRMPInvokerProxy.java:135)
       at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:96)
       at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:46)
       at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:53)
       at org.jboss.proxy.ejb.EntityInterceptor.invoke(EntityInterceptor.java:97)
       at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:85)
       at $Proxy2.getTradingCentre(Unknown Source)
       at Client.main(Client.java:50)
       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:324)
       at com.intellij.rt.execution.application.AppMain.main(Unknown Source)
      Caused by: java.rmi.ServerException: EJBException:; nested exception is:
       javax.ejb.EJBException: Load relation failed; CausedByException is:
       Expected to find "end of SQL command" instead found "." at position 113.
       at org.jboss.ejb.plugins.LogInterceptor.handleException(LogInterceptor.java:347)
       at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:195)
       at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
       at org.jboss.ejb.EntityContainer.internalInvoke(EntityContainer.java:484)
       at org.jboss.ejb.Container.invoke(Container.java:723)
       at sun.reflect.GeneratedMethodAccessor112.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:324)
       at org.jboss.mx.server.ReflectedDispatcher.dispatch(ReflectedDispatcher.java:60)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:61)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:53)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:185)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:473)
       at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:360)
       at sun.reflect.GeneratedMethodAccessor94.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:324)
       at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
       at sun.rmi.transport.Transport$1.run(Transport.java:148)
       at java.security.AccessController.doPrivileged(Native Method)
       at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
       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:536)
      Caused by: javax.ejb.EJBException: Load relation failed; CausedByException is:
       Expected to find "end of SQL command" instead found "." at position 113.
       at org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadRelationCommand.execute(JDBCLoadRelationCommand.java:208)
       at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.loadRelation(JDBCStoreManager.java:674)
       at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.load(JDBCCMRFieldBridge.java:1286)
       at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.getInstanceValue(JDBCCMRFieldBridge.java:646)
       at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.getValue(JDBCCMRFieldBridge.java:599)
       at org.jboss.ejb.plugins.cmp.bridge.EntityBridgeInvocationHandler$FieldGetInvoker.invoke(EntityBridgeInvocationHandler.java:133)
       at org.jboss.ejb.plugins.cmp.bridge.EntityBridgeInvocationHandler.invoke(EntityBridgeInvocationHandler.java:91)
       at org.jboss.proxy.compiler.Runtime.invoke(Runtime.java:62)
       at com.clarologic.pm.server.bean.entity.cmp.common_schema.TradableInstrumentBean$Proxy.getLocalTradingCentre(<generated>)
       at com.clarologic.pm.server.bean.entity.cmp.common_schema.TradableInstrumentBean.getTradingCentre(TradableInstrumentBean.java:59)
       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:324)
       at org.jboss.ejb.EntityContainer$ContainerInterceptor.invoke(EntityContainer.java:1114)
       at org.jboss.ejb.plugins.cmp.jdbc.JDBCRelationInterceptor.invoke(JDBCRelationInterceptor.java:72)
       at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invoke(EntitySynchronizationInterceptor.java:317)
       at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:185)
       at org.jboss.ejb.plugins.EntityReentranceInterceptor.invoke(EntityReentranceInterceptor.java:118)
       at org.jboss.ejb.plugins.EntityInstanceInterceptor.invoke(EntityInstanceInterceptor.java:175)
       at org.jboss.ejb.plugins.EntityLockInterceptor.invoke(EntityLockInterceptor.java:89)
       at org.jboss.ejb.plugins.EntityCreationInterceptor.invoke(EntityCreationInterceptor.java:54)
       at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:84)
       at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:315)
       at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:148)
       at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:120)
       at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
       ... 23 more
      
      



      Any pointers would be appreciated.

      Cheers
      -raj