On Thu, 2003-11-13 at 17:16, Phil Shrimpton wrote:
> Hi,
>
> I have an issue that I want to understand before I try and fix it...
>
> JBoss 3.2.2, Commit Option A...
>
> I have a SLSB method something like...
>
> public void doSomething(){
> Collection c = OrdersEJB.getItems();
> <loop through collection and do some calculations>
> <delete one of the 'items'>
> }
>
> If these method is called at the same time by two different clients, the
> first one works the second gives me an error because the OrdersEJB.getItems()
> returns a collection that includes the 'item' that has already been deleted
> by the first client, and I try to use it. Part of the stack trace....
>
>
> 2003-11-13 16:38:49,707 ERROR [org.jboss.ejb.plugins.LogInterceptor]
> TransactionRolledbackLocalException in method: public abstract java.sql.Date
> com.prometricssoftware.CHaS2.ejb.core.diaryqueue.QueueLocal.getActionDate(),
> causedBy:
> javax.ejb.NoSuchObjectLocalException: Entity not found: primaryKey=102
> at
> org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor
> .java:158)
> at
> org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.
> java:267)
> at
> org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:128)
> at
> org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:11
> 8)
> at
> org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
> at
> org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinde
> rInterceptor.java:122)
> at
> org.jboss.ejb.EntityContainer.internalInvoke(EntityContainer.java:490)
> at org.jboss.ejb.Container.invoke(Container.java:700)
> at
> org.jboss.ejb.plugins.local.BaseLocalProxyFactory.invoke(BaseLocalProxyFacto
> ry.java:375)
> at
> org.jboss.ejb.plugins.local.EntityProxy.invoke(EntityProxy.java:38)
> at $Proxy468.getActionDate(Unknown Source)
> at
>
>
> ..now if I switch to Commit Option B for the 'item' EJB, I don't get this
> error, and all seems to work as I expect it to.
>
Under option A, it does the getItems() against the db.
But the actual iteration/load is done against the cache.
Under option B, it will recheck the db (a load) before the delete
because B cannot assume the db is in synch across transactions.
I can only assume that the CMP engine is ignoring elements
that no longer exist under option B when it tries to reload?
Alex is that correct?
To avoid the problem in general, you need "repeatable read" isolation
which wouldn't work with commit option A/JBoss's Queued pessimistic
lock anyway. There a "locks" in the db jboss does take into
consideraton.
Regards,
Adrian
> Phil
--
xxxxxxxxxxxxxxxxxxxxxxxx
Adrian Brock
Director of Support
Back Office
JBoss Group, LLC
xxxxxxxxxxxxxxxxxxxxxxxx
-------------------------------------------------------
This SF.Net email sponsored by: ApacheCon 2003,
16-19 November in Las Vegas. Learn firsthand the latest
developments in Apache, PHP, Perl, XML, Java, MySQL,
WebDAV, and more! http://www.apachecon.com/
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user