Actually the "Oracle" in my code is the name with which my database is
configured in the properties file.

Also if that were an issue, I wouldn't get the connection object in the
first place.




                                                                                       
                                                
                      tsjuday@checkfree                                                
                                                
                      .com                     To:       "Turbine Torque Users List" 
<[EMAIL PROTECTED]>          
                                               cc:                                     
                                                
                      08/27/02 11:15 AM        Subject:  RE: Transaction               
                                                
                      Please respond to                                                
                                                
                      "Turbine Torque                                                  
                                                
                      Users List"                                                      
                                                
                                                                                       
                                                
                                                                                       
                                                





I don't know if this is the issue, but I think you're supposed to have

      conn = Transaction.begin(OneOfYourTablesPeer.DATABASE_NAME);

instead of

      conn = Transaction.begin("Oracle");

I am using Oracle also, and that is how I have it working.


Tobin Juday
Software Engineer
proud graduate of The Ohio State University
[EMAIL PROTECTED]
Phone: 614.564.4192
Pager: 877.546.0103

The #1 Way to Pay Online
http://www.checkfree.com/paybillsonline




                      [EMAIL PROTECTED]

                      om                       To:       "Turbine Torque
Users List" <[EMAIL PROTECTED]>
                                               cc:

                      08/27/2002 02:10         Subject:  RE: Transaction

                      PM

                      Please respond to

                      "Turbine Torque

                      Users List"








actually that was another user on the list....

here's the code I am using for beta 4

  public static void testTorque(){
    Connection conn = null;

    try{

        //conn = BasePeer.beginTransaction("Oracle");
        conn = Transaction.begin("Oracle");

        //do criteria
        Criteria crit = new Criteria();
        crit.add(TEcommCategoryPeer.STATUS,"Pending");
        List cats = TEcommCategoryPeer.doSelect(crit);
        Iterator i = cats.iterator();
        while(i.hasNext()){
          TEcommCategory cat = (TEcommCategory)i.next();
          cat.setStatus("Tanay");
          cat.save(conn);
        }

        //do items
        crit.clear();
        crit.add(TEcommItemPeer.STATUS,"Pending");
        List items = TEcommItemPeer.doSelect(crit);

        if(items.size()<1000){
          throw new Exception("Test Torque Exception");
        }

        Iterator j = items.iterator();
        while(j.hasNext()){
          TEcommItem item = (TEcommItem)j.next();
          item.setStatus("Tanay");
          item.save(conn);
        }

        //BasePeer.commitTransaction(conn);
        Transaction.commit(conn);

        System.out.println("COMMMITED SUCSESSFULLY");
    }
    catch(Exception e){
      e.printStackTrace(System.out);
      //do a roll back
      try {
        //BasePeer.rollBackTransaction(conn);
        Transaction.rollback(conn);

        System.out.println("ROLLED BACK SUCSESSFULLY");
      }
      catch (Exception ex) {
        ex.printStackTrace(System.out);
      }

    }

  }



Everything appears to work as expected - I get the "ROLLED BACK
SUCSESSFULLY" message printed on the console...
however when I check the database..I see that the updates did get committed
to the tables.

Note: However one quirky thing that I do notice is that the commits don't
happen instantly.. when I run this code and immediately go and check the
database..it appears that the rollbacks DID happen and the database did not
get updated..... however when I go and check again after a few minutes..the
database seems to have got updated which means that the rollbacks didn't
work....
I'm not sure why the delay is there...

thanks












                      "Stephen

                      Haberman"                To:       "'Turbine Torque
Users List'" <[EMAIL PROTECTED]>
                      <stephenh@chase30        cc:

                      00.com>                  Subject:  RE: Transaction


                      08/27/02 10:43 AM
                      Please respond to

                      "Turbine Torque

                      Users List"







You replied to a message that just said it worked (unless they were not
using b4, but I will assume they were). How are you using the
transaction and why does it not work?

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, August 27, 2002 12:40 PM
> To: Turbine Torque Users List
> Subject: Re: Transaction
>
>
> Did transaction work for you in beta 4 ??
> It still does not for me....
>
> has anyone else tried any transaction related stuff with beta 4 ?
>
> thanks
>
>
>


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







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







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







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

Reply via email to