9 Replies Latest reply on Jan 23, 2003 3:05 PM by Brian Benton

    Isolation level setting

    Ramesh Bodake Newbie

      Hi,

      I am trying to move my entire application from weblogic to jboss but not getting how to set the isolation level for CMP bean method level in jboss.

      Please clarify my doubts is it possible to set the isolation level in the bean level method or not?.

        • 1. Re: Isolation level setting
          David Jencks Master

          Can you explain exactly what you mean by isolation level?

          • 2. Re: Isolation level setting
            Ramesh Bodake Newbie

            Hi,

            I have the setting of isolation in bean level method at the weblogic.Please see the below
            <transaction-isolation>
            <isolation-level>TRANSACTION_READ_UNCOMMITTED</isolation-level>
            <method>
            <ejb-name>DAOSessionBean</ejb-name>
            <method-intf>Remote</method-intf>
            <method-name>select</method-name>
            </method>
            </transaction-isolation>

            Same thing I want to put into the jboss. can you help me how can I achieve the above in the jboss.

            • 3. Re: Isolation level setting
              David Jencks Master

              You can set the transaction isolation level for a datasource in the XADataSourceLoader config for jboss 2.4.4 and later and as a ManagedConnectionFactoryProperties property in jboss 3 rc2 and later. You can use the strings or the integer values.

              • 4. Re: Isolation level setting
                Ramesh Bodake Newbie

                Thanks!!

                I need to set the transaction isolation level each bean method level that means I have one session bean it contains four methods i,e select,update, delete and insert. I need to set the isolaton level like TRANSACTION_READ_COMMITED for the insert method and TRANSACTION_READ_UNCOMMITED for select method.this is possible in the weblogic and websphere also.

                Can I know how can I achieve same thing in JBoss. if give some example It could be very helpful.

                • 5. Re: Isolation level setting
                  David Jencks Master

                  This is not supported in jboss. Can you explain why this is important? The particular example you give doesn't make any sense to me. All the databases I have worked with will not let 2 transactions try to insert the same row simultaneously no matter what the isolation level.

                  • 6. Re: Isolation level setting
                    Ramesh Bodake Newbie

                    I have problem with only the select operation.This transaction should read uncommitted data (data changed by different transaction that is still in progress) so that I want to set the transaction isolation level READ_UNCOMMITED for the select operation in bean method level. there is no issue with other operations like insert,update,etc.,

                    Please let me know clearly is it possible to set the transaction isolaiton level in bean method level.since I know that only we can set transaction isolation level in the datasource level or connection level in the jboss.






                    • 7. Re: Isolation level setting
                      David Jencks Master

                      Well, I thought I was pretty clear, let me try again.

                      > This is not supported in jboss.
                      This means that the feature you are asking about, setting tx isolation level per method, is not supported in the product you are asking about, jboss.

                      Can you explain why
                      > this is important? The particular example you give
                      > doesn't make any sense to me. All the databases I
                      > have worked with will not let 2 transactions try to
                      > insert the same row simultaneously no matter what the
                      > isolation level.

                      This means that you would IMO get the same results if the tx isolation level was read uncommitted for all methods. I'd still like to know why you want different tx isolation levels for different methods. You made it pretty clear that you did want different isolation levels, and I do know what read uncommitted means. I'm not going spend any time thinking about whether this is a useful feature I should consider implementing unless there is a convincing use case showing a real business scenario that can't be done another way.

                      • 8. Re: Isolation level setting
                        ali mostofizadeh Newbie

                        I also need this feature; setting the isolation-level at method level.

                        I am trying to implement optimistic locking. I need to read/compare/update in a serialized transaction. This is the only time that I need a serialized transaction and I don't want to enforce this level elsewhere. The only way that I could think of achieving this was to create two data-sources with different isolation levels pointing to the same database.

                        Is there a better way?

                        Thanks in advance.

                        • 9. Re: Isolation level setting
                          Brian Benton Newbie

                          I also would like to have the capability of setting the transaction isolation level on a per method basis (as in WebLogic or WebSphere). I also do not need (or want) a setting of TRANSACTION_SERIALIZABLE everywhere. This is too much overhead in the database when TRANSACTION_READ_COMMITTED will suffice. Yes, you can setup separate connection pools with each isolation level and create a datasource for each. But that would only give you transaction isolation on a per bean basis and is also more difficult to configure.

                          I am using Option B commit strategy with an entity bean instance per transaction. In other words, I am deferring concurrency and transaction isolation implementation to the database.

                          Brian Benton