Hi,

if u use read_uncommitted  it gives you all the uncommitted data in other
transactions
context also. That should be true.

As far as my understading, closing the connection might not force a commit.
What might happen is, at the end of the transaction, you might get a
rollback saying cannot commit(write ) to the table since the connection is
broken.

Why not perform the operation you want to do in meth2 for the record
immediately once it is inserted using meth1 instead of waiting to get all
records to be inserted using meth1.

Regards,
Swaminathan K.N.




-----Original Message-----
From: Kher M [mailto:[EMAIL PROTECTED]]
Sent: Monday, October 22, 2001 6:55 AM
To: [EMAIL PROTECTED]
Subject: Re: Problems in transactions


Hi,
 Sorry if my mail was confusing for u.

  i just want to know how to force commit of meth1().
Is there any other way other than using requiers new
as the transaction attribute. That was a general doubt
that came to me when i was writing the mail.

 I want to commit only after meth1() and meth2(). The
doubt i got is if i use read_uncommitted wont it give
me all the uncommitted data in other transactions
context also. I think by default i should be able to
access the inserts done in the same transaction.


any replies for this
another scenario i want to ask about is
  remoteMet(){
   meth1();
   meth2();
  }
  meth1(){
   get connection
    do operations
   close connection
  }
  meth2(){
   get connection
    do some operation
   close connection
  }

  What i want to ask is will the meth1() commit when
 i close the connection.
  If yes what if i use a entity bean in both the
 methods. Even that may use a
 different connection for each entity bean.


Regards
Cherry

--- Swaminathan K N
<[EMAIL PROTECTED]> wrote:
> Hi,
>  I think you are probably a bit confused about what
> you want. Lets look at
> the statements you have given
> 1. but i dont want the meth1() to commit before
> meth2() finishes.
> 2. how will i force the entity bean to commit the
> operations done in meth1()
> before calling meth2()
>
> So I am not sure whether you want to commit after
> meth1 and before meth2.
>
>
> Assume if you want to commit after meth1 and before
> meth2, then what you
> said having different isolation levels for
> meth1(Read_Uncommited ) and meth2
> (Read_committed ) within the same transaction will
> not work. You will get an
> Isolation Level Change Exception. So the solution is
> have meth1 and meth2 in
> different transactions.
>
> Assume if you dont want to commit after meth1 but
> only after math2 , but
> still want to access what you have inserted in
> meth1, then you might have to
> make both meth1 and meth2 as Read_UnCommitted.
>
> Thats my view of this problem.
>
> Lets see what others have to say about this.
>
>
> Regards,
> Swaminathan K.N.
>
>
>
> -----Original Message-----
> From: Cherry Mathew [mailto:[EMAIL PROTECTED]]
> Sent: Monday, October 22, 2001 5:13 AM
> To: [EMAIL PROTECTED]
> Subject: Re: Problems in transactions
>
>
> Hi Gene,
> but i dont want the meth1() to commit before meth2()
> finishes.
> Do u mean to say that there is nothing i can do
> about this?.
> Again another scenario i want to ask about is
>  remoteMet(){
>   meth1();
>   meth2();
>  }
>  meth1(){
>   get connection
>    do operations
>   close connection
>  }
>  meth2(){
>   get connection
>    do some operation
>   close connection
>  }
>
>  What i want to ask is will the meth1() commit when
> i close the connection.
>  If yes what if i use a entity bean in both the
> methods. Even that may use a
> different connection for each entity bean.
>  again in the same scenario. how will i force the
> entity bean to commit the
> operations done in meth1() before calling meth2(). I
> want to use container
> managed transaction. One option is to use isolation
> level read uncommitted
> in meth2().Is there a cleaner way of doing this?.
>  I want to do this because im using the entity bean
> to insert 1000 records
> in the database. And in meth2() im sorting those
> records. If i go for direct
> JDBC insert then it will affect the preformance. and
> if i use the entity
> bean for sorting again it will affect performance.
>  Can someone give me more details about how
> transaction is maintained across
> connections if it can done.
>  If transaction cannot be maintained across
> connections then how can we rely
> on the entity baen call (to be part of transaction).
>
> --- Gene Chuang <[EMAIL PROTECTED]> wrote:
> > Hi Cherry,
> >
> > The problem you are seeing occurs when you mix EJB
> > and JDBC invocation within a single
> > transaction, and is an issue that's expressed (and
> > solvable) in many containers which has
> > a caching mechanism for EJBs.
> >
> > For example, under weblogic, if you set
> > <commit-at-end-of-transaction> to false, this
> > will force all ejb changes to commit immediately,
> > hence allowing your JDBC calls to see
> > these changes.
>
> Thanx a lot Gene
> >
> > Hope that helps!
> >
> > Gene
> > --- Cherry Mathew <[EMAIL PROTECTED]> wrote:
> > > Hi Michael,
> > >  I used the dafault isolation level that is READ
> > COMMITTED.  If im in the same
> > > transaction dont u think that i need to get the
> > values which were inserted in meth1()
> > > whether i commit meth1() or not?.
> > >
> > > i start a transaction in remoteMeth()
> > > call meth1() which uses entity bean to create
> > records in the database.
> > > now from remoteMeth() i call meth2() and try to
> > access these records. And im not
> > > getting these records in meth2().
> > > I think since im inserting records in the same
> > transaction i need to get the records
> > > for updates in the same transaction context.
> > >  If im trying to access the records in a
> different
> > transaction context it shouldnt give
> > > me uncommitted records. But when in same
> > transaction contect i should get the values.
> > >
> > > Thank u very much
> > >
> > > Cherry Mathew
> > >
> > >
> > > --- tetex <[EMAIL PROTECTED]> wrote:
> > > > What's the isolation level for each
> connection?
> > I
> > > > would consider this.
> > > >
> > > > Michael
> > > >
> > > > ----- Original Message -----
> > > > From: "Cherry Mathew" <[EMAIL PROTECTED]>
> > > > To: <[EMAIL PROTECTED]>
> > > > Sent: Saturday, October 20, 2001 6:35 AM
> > > > Subject: Problems in transactions
> > > >
> > > >
> > > > > Scenario,
> > > > >
> > > > > Session bean
> > > > > ------------
> > > > >  public void remoteMeth(){
> > > > >    meth1();
> > > > >    meth2();
> > > > >  }
> > > > >  public void meth1(){
> > > > >    //uses entity bean to insert data into
> the
> > > > databaseTable
> > > > >    //transaction type is required
> > > > >  }
> > > > >  public void meth2(){
> > > > >   // gets a connection using JNDI lookup
> from
> > the
> > > > connection pool
> > > > >   // Does updates on the same table on which
> > meth2
> > > > inserts data into
> > > > >   // transaction type is required
> > > > >   // the problem is that this function is
> not
> > > > finding any rows in the
> > > > >     databaseTable to update
> > > > >  }
> > > > >
> > > > >  ( the inserts by the Entity bean succedes.
> )
> > > > >
> > > > >  from this what i think is that both the
> > methods
> > > > are not executing in the
> > > > same transaction context.
> > > > >  But why?. When the  call comes to the
> remote
> > > > method a new transaction is
> > > > created. meth1() and meth2() should take this
> > same
> > > > transaction.
> > > > >
> > > > >  Am i missing something. The reason i can
>
=== message truncated ===


__________________________________________________
Do You Yahoo!?
Make a great connection at Yahoo! Personals.
http://personals.yahoo.com

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".
****************************************************************************
This communication contains information, which is confidential and may also
be privileged. It is for the exclusive use of the intended recipient(s). If
you are not the intended recipient(s), please note that any distribution,
printing, copying or use of this communication or the information in it is
strictly prohibited. If you have received this communication in error,
please notify the sender immediately and then destroy any copies of it.
****************************************************************************

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to