I created a BMP entity bean that has a findByPrimaryKey() function that loads the
bean. jBoss loads it
correctly, but for some reason calls ejbStore() on it twice. I figured it would call
ejbLoad before it called ejbStore again.
This gives me a problem because I have a timestamp field in the table. The save
stored
proc expects to have the same timestamp as it had before or it throws an exception.
If
it is the same, the stored proc will give the timestamp field a new value. This is to
make sure that before record can be saved, the current record was viewed. The problem
is that the timestamp was changed by the first ejbStore call to the stored proc, but
the
entity bean was never updated with the new data, therefore the second call to ejbStore
called the stored proc with an old timestamp, and the stored proc threw an error.
So my question is two-fold. Why did it call ejbStore twice in a row without calling
ejbLoad? and Why did it not automatically update my entity bean when the data in the
database was changed?
[Container factory] Deploying Bank
[Container factory] Deployed application:
file:/home/johns/jBoss-2.0_FINAL/bin/../tmp/deploy/Bank.jar/ejb1006.jar
[J2EE Deployer] J2EE application: file:/home/johns/jBoss-2.0_FINAL/deploy/Bank.jar is
deployed.
[Bank] ejbFindByPrimaryKey()
[Bank] id = 105
[Bank] ejbLoad()
[Bank] timestamp = [B@56747b
[Bank] ejbStore.store()
[Bank] timestamp = [B@56747b
[Bank] ejbStore.store()
[Bank] timestamp = [B@56747b
[Bank] java.rmi.RemoteException: com.sybase.jdbc2.jdbc.SybSQLException: bo_daemon
Contact Info: : The timestamp shows that the row has been updated by another user.
Please close this window and try again.
[Bank] at BankBean.ejbStore(BankBean.java:298)
[Bank] at java.lang.reflect.Method.invoke(Native Method)
[Bank] at
org.jboss.ejb.plugins.BMPPersistenceManager.storeEntity(BMPPersistenceManager.java:305)
[Bank] at
org.jboss.ejb.plugins.EntitySynchronizationInterceptor$InstanceSynchronization.beforeCom
pletion(EntitySynchronizationInterceptor.java:343)
[Bank] at org.jboss.tm.TxCapsule.doBeforeCompletion(TxCapsule.java:1104)
[Bank] at org.jboss.tm.TxCapsule.commit(TxCapsule.java:278)
[Bank] at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:76)
[Bank] at
org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:318)
[Bank] at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:99)
[Bank] at
org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:144)
[Bank] at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:192)
[Bank] at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:323)
[Bank] at
org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invoke(JRMPContainerInvoker.java:
163)
[Bank] at java.lang.reflect.Method.invoke(Native Method)
[Bank] at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:241)
[Bank] at sun.rmi.transport.Transport$1.run(Transport.java:142)
[Bank] at java.security.AccessController.doPrivileged(Native Method)
[Bank] at sun.rmi.transport.Transport.serviceCall(Transport.java:139)
[Bank] at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:443)
[Bank] at
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:643)
[Bank] at java.lang.Thread.run(Thread.java:484)
--
--------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
List Help?: [EMAIL PROTECTED]