Hi again,

I checked in a fix in CVS. Get latest from CVS or replace
PersistenceBrokerFactorySyncImpl class (if you using rc6).
Now within a JTA-tx always the same PB instance was used.

regards,
Armin

Armin Waibel wrote:

Hi Mike,

 > within the J2EE environment.  I guess I was expecting it to only return
 > a single Persistence Broker per EJB Transaction even when the factory is
 > called multiple times.  This does not seem to be what I am
 > experiencing.  I have thought of a couple of ways of handling this
 > myself, but none of them are particularly elegant.  Hence, the reason
 > for this message.

I assume you found a bug. In scope of a transaction OJB should indeed use the same PB instance for the whole tx. The creation of 85 PB instances indicate that this isn't the case in managed environments ;-)

Responsible for PB instance creation in managed environments is PersistenceBrokerFactorySyncImpl class.
When lookup a PB instance within a tx the already used instance should be returned.
Locally I patch PersistenceBrokerFactorySyncImpl, when the ejb-tests pass I will check this fix tomorrow.
Thank you very much for the detailed problem description.


regards,
Armin


Michael A. Hovan III wrote:


I have been using OJB within JBOSS for almost 2 years with great success. Until recently i have only had very simple Persistence Broker "query" or "store" calls wrapped within Stateless Session Bean method calls. Recently some of my EJB methods have gotten significantly more complex, having many OJB query and store requests per EJB transaction. I have now started to see the occasional Optimistic Lock Exception and have been perplexed as to its cause. I did some investigating and found that an OJB query would occasionally return an outdated copy of an object.


I upgraded to the latest JBOSS and OJB (JBOSS 3.2.3 from 3.0.7 and OJB 1.0rc6 from 1.0rc4) hoping that there was some bug which I was tickling in one of these 3rd party tools. Much to my surprise, in the new configuration I was getting 85 Persistence Brokers created in my first complex EJB method call. This has led me to believe that I have had an incorrect expectation about how the Persistence Broker Factories work within the J2EE environment. I guess I was expecting it to only return a single Persistence Broker per EJB Transaction even when the factory is called multiple times. This does not seem to be what I am experiencing. I have thought of a couple of ways of handling this myself, but none of them are particularly elegant. Hence, the reason for this message.

Is there a best practice for guaranteeing a one-to-one mapping between Persistence Brokers and EJB Transactions? And, is this the appropriate path to be taking? Or, should I investigate a different cache technique than "Per Broker"? Or, have I made some other error? BTW, I grab my PB Factory using JNDI and have just sprinkled these calls in wherever I need to grab a PB.


Thanks,

Mike


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]




--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]




--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to