Christophe,
that's exactly how we patched Castor about a year ago, iow that should work. Just wondering: did that resolve your problem(s) ?
Werner
--Original Message Text---
From: Christophe Frey
Date: Fri, 12 Sep 2003 22:38:08 +0200 (CEST)
Hi Werner,
First of all, I realize that I didn't give you all
the information, my code was called from a stateless
EJB which was deployed with a container manage attribute
and it's why the connection I get are already bind
to the transaction.
To attach the database object from castor to my container
manage transaction I've just add a patch in my JDO class :
In the method public Database getDatabase(), I replace the
following code :
if(tm==null)
{
ctx = new InitialContext();
tm = (TransactionManager) ctx.lookup(_tmName);
}
tx = tm.getTransaction();
By the following code :
TransactionManager transactionManager = JTXA.getTransactionManager();
tx = TM.getTransaction();
IT's just a patch but it works for me ...and everyone that use
websphere with container manage transaction ;o)
Christophe
Werner Guttmann <[EMAIL PROTECTED]> wrote: Christophe,
can yo please post some code fragments that show waht you are trying to achieve ? Without these, it's going to be
hard to comment upon things.
Other than this, please see inline ...
Werner
--Original Message Text---
From: Christophe Frey
Date: Thu, 11 Sep 2003 20:46:01 +0200 (CEST)
Thank you very much Werner,
I investigated on my side and I found that I can
get the transaction on my thread via the method :
com.ibm.ejs.jts.jta. JTSXA.getTransactionManager();
werner --> Yes, this is how to obtain the javax.jata.TransacttionManager within WebSphere. But this does not
associate transactions with your threads of execution.
I added this in my JDO and now it works :o)
werner --> Can you show! us where you added it ?
Indeed I'm waiting for the next release of castor :o)
For the discussion on the datasource I don't understand
how it shoul work. It looks like the datasource that I lookup
from my jndi context is actually associate with the transaction.
werner --> No, it isn't. What's your deployment unit ? EJBs or web applications ? If you e.g. are deploying EJBs and
use container-managed transactions, it's the container that intercepts calls to your EJBs and starts/commits
transactions.
I made a test, creating a record without begin and commit on the
connection that I get from the datasource and at the end of
the transaction, the record was create ..... It means that my
connection was associate with the transaction no ???????
werner --> NO, it simply means that by default, on a JDBC connection, auto-commit mode is turned on.
Thanks
Christophe
Werner Guttmann <[EMAIL PROTECTED]> wrote:
Christophe,
please see inline ...
Werner
--Original Message Text---
From: Christophe Frey
Date: Wed, 10 Sep 2003 15:44:50 +0200 (CEST)
Thanks to answer so quickly !!!!
But I don't understand how it should work.
1. The datasource that I look up is already associate
with a Transaction so why must I register the JDO
with the transaction
werner --> That's actually a statement which is partly right and partly wrong. It is not true that the DataSource is
*associated* with a transaction when you look it up. Your DataSource (assuming it's an instance of XADataSource or
a similar class) is a class that is capable of being part of a distributed (XA-enabled) transaction, but that's it. In other
words, because of this, it can be ! part of a distrubuted transaction ! that is managed by a transaction manager, e.g.
WebSphere's transaction coordinator. But once again, it is *NOT* associated with a transaction.
2 . How can I know the jndi name of my container
manage transaction in Websphere 4 (I don't even
know that such a thing was possible for a
container manage transaction :o( )
werner --> Oops, forgot to add this in my original reply. Unfortunately, the answer is a bit complicated. But here we go:
as almost always, IBM with WebSphere has decided to not expose the transaction manager via a naming and
directory service such as JNDI, but only in a custom-way. In other words, I could send you a patch which you'd have
to apply against the Castor sources and build Castor yourself (which is what I did in my previous job at msdw). Though
if you happen to have some time at your fingers (a couple of weeks), please be patient and wait for (I think) the next
release. I've submitted a (quite elabora! te) pa! tch a couple of days ago that in the end is a complete rewrite of how
Castor interacts with transaction managers. And this new module will have support for Websphere 4 and 5 out of the
box.
Thanks
Christophe
Werner Guttmann <[EMAIL PROTECTED]> wrote:
Christophe,
as you are using WebSphere 4, did you instruct Castor about the fact that you are deploying your application on a
web/ejb container and that you want to use container-managed transactions. All this can be done by calling
JDO.setTransactionManager()
and providing the JNDI ENC of the transaction manager.
If you have not done so, the TransactionNotInProgressException signals that a transactrion has not been started yet,
and Castor requires a transaction in progress before you can create/load/update objects. This can either be
achieved by starting a (local) transaction man! ually (Database.begin()), running your ejb app with container-manag! ed
transactions enabled or using the UserTransaction interface to control transaction demarcation yourself.
I hope ! this helps ...
Werner
--Original Message Text---
From: Christophe Frey
Date: Tue, 9 Sep 2003 22:51:59 +0200 (CEST)
I'm trying to test castor with websphere 4 and I can't make it work in my
container manage transaction. I've create a new Datasource test
in my whebsphere instance, when in test it directly it works fine.
Now when I try to associate use it with castor the problem begin :o(
First I have create my database an mapping file.
My database file contains an element jndi with
the name of the jndi name of the datasource for attribute.
When I try to create a new Object in my database the method
DatabaseImpl.getTransaction throw a
TransactionNotInProgressException ????
Did! I make something wrong ???? (My transaction is ! container manage ...)
It works fine when I use directly the datasource !!!!!!!
The BD is an Oracle 8i instance.
The datasource is a oracle.jdbc.pool.OracleConnectionPoolDataSource class.
Thanks to help me.
Christophe Frey
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en fran�ais !
Testez le nouveau Yahoo! Mail
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en fran�ais !
Testez le nouveau Yahoo! Mail
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en fran�ais !
Testez le nouveau Yahoo! Mail
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en fran�ais !
Testez le nouveau Yahoo! Mail
- [castor-dev] websphere, datasource, jndi and castor = Tran... Christophe Frey
- Re: [castor-dev] websphere, datasource, jndi and cast... Werner Guttmann
- Re: [castor-dev] websphere, datasource, jndi and ... Christophe Frey
- Re: [castor-dev] websphere, datasource, jndi and cast... Werner Guttmann
- Re: [castor-dev] websphere, datasource, jndi and ... Christophe Frey
- Re: [castor-dev] websphere, datasource, jndi and cast... Werner Guttmann
- Re: [castor-dev] websphere, datasource, jndi and ... Christophe Frey
- [castor-dev] Velcocity and Castor Deepak A N
- Re: [castor-dev] Velcocity and Castor Bruce Snyder
- Re: [castor-dev] websphere, datasource, jndi and cast... Werner Guttmann
- Re: [castor-dev] websphere, datasource, jndi and ... Christophe Frey
