geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Olivier Voutat" <olivier.vou...@gmail.com>
Subject Re: FindByPrimaryKey
Date Wed, 05 Apr 2006 15:08:32 GMT
Or even using the PostGreSQL (the sql basic syntax isn't that diferent
neither)

Best Regards,
Olivier Voutat

On 4/5/06, Olivier Voutat <olivier.voutat@gmail.com> wrote:
>
> Oh Gianny,
>
> May that be the reason why my findByPrimaryKey and getPrimaryKey are
> acting weird ?
>
> When I use the getPrimaryKey (I have ClassPK) instead of returning a
> ClassPK object, it gives me a String object. And the findByPrimaryKey
> doesn't work at all (data infomation in the end)
>
> Since the basic sql language in Firebird is the same in MS sql server,
> could I configure it using the db-syntax-factory of it ? Just changing the
> path to the database and the driver ?
>
> Best Regards,
> Olivier Voutat
>
>
> 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.TransactionRolledback
> LocalException
>         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/5/06, Olivier Voutat < olivier.voutat@gmail.com> wrote:
>
> > Sorry Gianny, but I didn't understand very well your question (big
> neubie in JEE). You mean the firebird sql syntax ? Or the EJB-SQL ?
>
> In firebird sql it is pretty much the same as MS sql server. update
> <table> set <column> = <value> where <other column> = <value>
>
> Sorry if I said anything stupid above, like I said big big neubie. Until
> now, the only big diferences that I got between SQL Server and Firebird were
> the procedures statements.
>
> Best Regards,
> Olivier Voutat
>
>
> On 4/5/06, Gianny Damour < gianny.damour@optusnet.com.au> wrote:
> >
> > Hi Olivier,
> >
> > I think that Firebird does not like the generated UPDATE statements.
> > More accurately it does not like the "SET <column> = CASE WHEN ? THEN ?
> > ELSE <column>" syntax.
> >
> > This problem has been fixed in head as the UPDATE statements will only
> > use the "SET <column> = ?" syntax. Meanwhile, do you know what the
> > Firebird syntax is to achieve the same result than "SET <column> = CASE
> > WHEN ? THEN ? ELSE <column>". If you give us this syntax, I think that
> > it should be quick easy to fix this problem (basically, we can implement
> > a DBSyntaxFactory and enable it by setting the db-syntax-factory element
> > of the openejb-jar DD).
> >
> > Thanks,
> > Gianny
> >
> > Olivier Voutat wrote:
> >
> > > Lol, there is no space, it is just the Ctrl-c Ctrl-v, cause there was
> > > no space in my writing e-mail window so it did a return line.
> > >
> > > Anyway, maybe it is a tip of which is the problem, but I tried to use
> > > my findBySituation, and it works BUT I don't get to alter the LocalCar
> > > (s)  returned.
> > >
> > > My code in my SessionBean
> >
> > <snip>
> >
> > >
> > > 00:34:32,073 WARN  [GeronimoConnectionEventListener]
> > > connectionErrorOccurred called with null
> > > org.firebirdsql.jdbc.FBSQLException: GDS Exception. 335544569. Dynamic
> > > SQL Error
> > > SQL error code = -104
> > > Token unknown - line 1, char 39
> > > THEN
> > >         at
> > > org.firebirdsql.jdbc.AbstractPreparedStatement.<init>(
> > AbstractPreparedStatement.java:118)
> > >         at org.firebirdsql.jdbc.FBPreparedStatement
> > > .<init>(FBPreparedStatement.java :40)
> >
> > <snip>
> >
> > > Caused by: org.tranql.ql.QueryException: Error executing statement:
> > > UPDATE CARROS SET MARCA = CASE WHEN ? THEN ? ELSE MARCA END, MODELO =
> > > CASE WHEN ? THEN ? ELSE MODELO END, PLACA = CASE WHEN ? THEN ? ELSE
> > > PLACA END, QUILOMETRAGEM = CASE WHEN ? THEN ? ELSE QUILOMETRAGEM END,
> > > COR = CASE WHEN ? THEN ? ELSE COR END, SITUACAO = CASE WHEN ? THEN ?
> > > ELSE SITUACAO END, TIPO = CASE WHEN ? THEN ? ELSE TIPO END, DIARIA =
> > > CASE WHEN ? THEN ? ELSE DIARIA END WHERE CHASSI = ?
> > >         at
> > > org.tranql.sql.jdbc.JDBCUpdateCommand.execute(JDBCUpdateCommand.java
> > :69)
> > >         at
> > > org.tranql.cache.SimpleFlushStrategy.flush (SimpleFlushStrategy.java
> > :64)
> > >         at org.tranql.cache.SimpleFlushStrategy.flush
> > > (SimpleFlushStrategy.java:49)
> > >         at
> > > org.tranql.cache.cache.InTxCacheTracker.flush(InTxCacheTracker.java:41)
> > >         at org.tranql.cache.InTxCache.flush(InTxCache.java:86)
> > >         at
> > >
> > org.apache.geronimo.transaction.context.AbstractTransactionContext.flushState
> > > (AbstractTransactionContext.java :115)
> > >         at
> > >
> > org.apache.geronimo.transaction.context.InheritableTransactionContext.complete
> > (InheritableTransactionContext.java:175)
> > >         ... 24 more
> > > Caused by: org.firebirdsql.jdbc.FBSQLExcep tion : GDS Exception.
> > > 335544569. Dynamic SQL Error
> > > SQL error code = -104
> > > Token unknown - line 1, char 39
> > > THEN
> > >         at
> > > org.firebirdsql.jdbc.AbstractPreparedStatement.<init>(
> > AbstractPreparedStatement.java:118)
> > >
> >
> >
> >
> >
>
>
> --
>
> 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
>



--
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