oops forgot to scroll down.

Thanks.  I'll give it a shot.  My problem is that I've got a DatabaseHelper
class that handles all Castor integration.  It needs to be used in different
contexts.  When its just being used with a servlet it needs to begin and
commit the transaction.  When its being used within an entity bean it
shouldn't handle its own transactions.  I'll need to detect whether a
seperate transaction manager is in place before making the begin and commit
calls



-----Original Message-----
From: Gray Jones [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 22, 2002 2:55 PM
To: [EMAIL PROTECTED]
Subject: Re: [castor-dev] Using Castor in a BMP entity bean


Would I still need to call begin() and commit()?  Or would that be handled
by the jta transaction manager?

Thanks!

-----Original Message-----
From: Ebersole, Steven [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 22, 2002 2:51 PM
To: [EMAIL PROTECTED]
Subject: Re: [castor-dev] Using Castor in a BMP entity bean


When setting up the JDO object, do the following call:

JDO _jdo = new JDO();
...
_jdo.setTransactionManager( "javax/transaction/TransactionManager" );




Then, just get a UserTransaction object from JNDI (or not if the container
will be managing the transaction).

UserTransaction ut = new InitialContext().lookup(
"javax/transaction/UserTransaction" );
if (ut.getStatus()==Status.STATUS_NO_TRANSACTION)
{
    log.debug( "Transaction was idle after get, starting" );
    ut.begin();
}
Database db = _jdo.getDatabase();

//...perform persistence...

ut.commit();
db.close();




********************************************
Steve Ebersole
IT Integration Engineer
Vignette Corporation
512.741.4195

Visit http://www.vignette.com

********************************************


-----Original Message-----
From: Gray Jones [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 22, 2002 12:40 PM
To: [EMAIL PROTECTED]
Subject: [castor-dev] Using Castor in a BMP entity bean


Can anybody point me to where I can find information about how to use castor
in a bean managed entity bean?

I don't see how I can connect castor to use the app server's (jBoss)
transaction management.  Also i'm assuming that if I was able to get castor
to use the transactions from the app server, then I shouldn't be calling
commit() from within the castor related code.  right?

Thanks,

Gray Jones

-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to