jboss default config is pessimistic concurrency.  It can be configured in other ways, but this will be described in soon-to-be-released for-pay docs.  Search the jboss-dev and jboss-user archives though.  You'll find lots of info.
 
Bill
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Alice Ad
Sent: Tuesday, July 09, 2002 10:18 PM
To: [EMAIL PROTECTED]
Subject: RE: [JBoss-user] Are read only methods supposed to lock entity beans?

Thanks Bill. A few more questions:

1. Will it work if method1 is read-only and method2 is not? (I guess)

(The following question is not directly related to the 1st one)

2. My DB has an isolation level of READ_COMMITTED. Is there a way to enforce SERIALIZABLE at app server level? And if yes, does the app server use optimistic or pessimistic locking?

3. Do EJB specs guide on this (read only/ transaction isolation at app server level) or it's vendor dependent? Does JBoss have any docs on this?

Thanks so much.

  Bill Burke <[EMAIL PROTECTED]> wrote:

Marking a method as RequiresNew, does not mean that the method is read-only, it just means that a new transaction must be started.  Since the entity bean is already in a transaction the second call with hang.  With JBoss 3.0, you can now define read-only methods, but I warn you, your test will still hang unless method 1 is a read-only method too.
 

<jboss>

    <enterprise-beans>

       <entity>

           <ejb-name>nextgen.EnterpriseEntity</ejb-name>

           <jndi-name>nextgen.EnterpriseEntity</jndi-name>

           <method-attributes>

               <method>

                   <method-name>get*</method-name>

                   <read-only>true</read-only>

               </method>

               <method>

                   <method-name>anotherReadOnlyMethod</method-name>

                   <read-only>true</read-only>

               </method>

           </method-attributes>

       </entity>

    </enterprise-beans>

</jboss>

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Alice Ad
Sent: Tuesday, July 09, 2002 5:45 PM
To: jboss
Subject: [JBoss-user] Are read only methods supposed to lock entity beans?

Hello,

The following code hangs because it first calls an entity bean instance's method that has "Required" attribute and then calls the same instance's method that has "RequiresNew" attribute. The 1st transaction is blocking the second one.

// the following code hangs
class SessionBean {
public void hasRequiredAttribute() {
entityBean.hasRequiredAttribute(); // method 1
// it hangs here !!
entityBean.hasRequiresNewAttribute(); // method 2
}
}


If method 1 above is a read only method, why is the entity bean locked? Shouldn't it allow another transaction from the same thread use the entity bean??

Thanks so much.



Do You Yahoo!?
New! SBC Yahoo! Dial - 1st Month Free & unlimited access



Do You Yahoo!?
New! SBC Yahoo! Dial - 1st Month Free & unlimited access

Reply via email to