Discussions

EJB programming & troubleshooting: CMR problem, column unknown

  1. CMR problem, column unknown (1 messages)

    Hi there. Im' developing an appplication using EJB 2.1, JBuilder 2006, firebird and jboss-4.0.4.GA. I'm creating the Beans using the JBuilder's wizard. My problem is when I'm creating a relationship bidirectional, no matter if is many-to-one or one-to-many, I get the unknown error when trying to create a bean. I have a bean called Bodega which has many beans called Usuario and the ejb-jar looks like this: bodega-usuario bodega BodegaRelationshipRole One bodega Bodega usuario usuarios java.util.Collection usuario UsuarioRelationshipRole Many usuario Usuario bodega bodega When I try to create a Usuario, i get the next error: 13:30:41,375 ERROR [LogInterceptor] TransactionRolledbackLocalException in method: public abstract java.util.Collection easyserver.modelo.ejb.Bodega.getUsuarios(), causedBy: org.firebirdsql.jdbc.FBSQLException: GDS Exception. 335544569. Dynamic SQL Error SQL error code = -206 Column unknown BODEGA At line 1, column 38. at org.firebirdsql.jdbc.AbstractPreparedStatement.(AbstractPreparedStatement.java:118) at org.firebirdsql.jdbc.FBPreparedStatement.(FBPreparedStatement.java:40) at org.firebirdsql.jdbc.AbstractConnection.prepareStatement(AbstractConnection.java:849) at org.firebirdsql.jdbc.AbstractConnection.prepareStatement(AbstractConnection.java:812) at org.firebirdsql.jdbc.AbstractConnection.prepareStatement(AbstractConnection.java:805) at org.firebirdsql.jdbc.AbstractConnection.prepareStatement(AbstractConnection.java:286) at org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadRelationCommand.execute(JDBCLoadRelationCommand.java:97) at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.loadRelation(JDBCStoreManager.java:705) at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.load(JDBCCMRFieldBridge.java:1417) at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.getInstanceValue(JDBCCMRFieldBridge.java:732) at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge.getValue(JDBCCMRFieldBridge.java:684) at org.jboss.ejb.plugins.cmp.bridge.EntityBridgeInvocationHandler$FieldGetInvoker.invoke(EntityBridgeInvocationHandler.java:147) at org.jboss.ejb.plugins.cmp.bridge.EntityBridgeInvocationHandler.invoke(EntityBridgeInvocationHandler.java:105) at org.jboss.proxy.compiler.Runtime.invoke(Runtime.java:76) at easyserver.modelo.ejb.BodegaBean$Proxy.getUsuarios() 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:359) at org.jboss.ejb.EntityContainer$ContainerInterceptor.invoke(EntityContainer.java:1191) at org.jboss.ejb.plugins.cmp.jdbc.JDBCRelationInterceptor.invoke(JDBCRelationInterceptor.java:87) at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invoke(EntitySynchronizationInterceptor.java:284) at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:158) at org.jboss.ejb.plugins.EntityReentranceInterceptor.invoke(EntityReentranceInterceptor.java:126) at org.jboss.ejb.plugins.EntityInstanceInterceptor.invoke(EntityInstanceInterceptor.java:276) at org.jboss.ejb.plugins.EntityLockInterceptor.invoke(EntityLockInterceptor.java:104) at org.jboss.ejb.plugins.EntityCreationInterceptor.invoke(EntityCreationInterceptor.java:68) at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:63) at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:121) at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:350) at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:181) at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:168) at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205) at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:136) at org.jboss.ejb.EntityContainer.internalInvoke(EntityContainer.java:520) at org.jboss.ejb.Container.invoke(Container.java:954) at org.jboss.ejb.plugins.local.BaseLocalProxyFactory.invoke(BaseLocalProxyFactory.java:430) at org.jboss.ejb.plugins.local.EntityProxy.invoke(EntityProxy.java:65) at $Proxy136.getUsuarios(Unknown Source) at easyserver.modelo.dto.BodegaDTO.createDto(BodegaDTO.java:217) at easyserver.controlador.GestionBean.getBodegaByPK(GestionBean.java:462) 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:359) at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:237) at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:158) at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:169) at org.jboss.ws.server.ServiceEndpointInterceptor.invoke(ServiceEndpointInterceptor.java:64) at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:63) at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:121) at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:350) at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:181) at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:168) at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205) at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:136) at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:648) at org.jboss.ejb.Container.invoke(Container.java:954) 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:155) at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94) at org.jboss.mx.server.Invocation.invoke(Invocation.java:86) at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264) at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659) at org.jboss.invocation.jrmp.server.JRMPInvoker$MBeanServerAction.invoke(JRMPInvoker.java:819) at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:420) 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) I don't know why, but I think that the container is trying to find cmr field in the database. I think that's not what it should do, right? Thanks, I'm really delayed beacasue of this problem.
  2. Re: CMR problem, column unknown[ Go to top ]

    Hi Alexis, for mapping CMR fields to Database table columns you have to provide a vendor specific CMR mapping file besides the standard ejb-jar.xml. There you can define the columns to be used for the foreign key needed for one-to-one or one-to-many relationships. In your case in the table for "usuario" objects you need to have a special column containing the foreign key specifying the associated "bodega". I assume the JBoss CMP engine takes the CMR field name as default name for this foreign key column when no mapping file is specified. Your database table for "usuario" objects obviously does not contain a column named "bodega". Since you use JBoss (4?), here's the link to the documentation for this file named "jbosscmp-jdbc.xml" with regard to CMR mapping: http://docs.jboss.org/jbossas/jboss4guide/r5/html/ch11.chapter.html#d0e24377 Hope that helps, René