You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by "Ramaswamy, Muthu" <mr...@gers.com> on 2005/02/04 22:56:09 UTC
JDO with CMT.
Hi All-
Currently I am trying to use Apache/OJB with JDO support in Session Beans, using Container Manager Transaction(CMT) in Websphere 5.1.
When I executed the Session Bean, I get the following error:
"Exception data: javax.jdo.JDOUserException: Transaction is not active."
I have attached below the sample code:
//Setting up the Bean
AuthUserJDO usr = new AuthUserJDO();
usr.setUsr_login("cocoon");
usr.setUsr_fullname("Demo");
usr.setUsr_password("moth");
usr.setUsr_email("xyz@abc.org");
//Get a PersistentManager
PersistenceManagerFactory factory = new OjbStorePMF(); //factory.
PersistenceManager manager = factory.getPersistenceManager(); //get the manager.
manager.makePersistent(usr); //make persistent.
manager.close(); //close the manager.
I am new to Apache/OJB. Is there an example working program that shows how to use JDO with CMT inside Session Bean? Any code sample would help to resolve this issue.
Appreciate your time. Thanks.,
-Muthu
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org
Re: JDO with CMT.
Posted by Thomas Dudziak <to...@gmail.com>.
You cannot simply call makePersistent, you have to start a transaction
first (this is unrelated to whether you're using it with EJB or not):
Transaction tx = null;
try
{
tx = manager.currentTransaction();
tx.begin();
manager.makePersistent(user);
tx.commit();
}
catch (Exception e)
{
if (tx.isActive())
{
tx.rollback();
}
}
Have a look here for an example of using JDO:
http://www.onjava.com/pub/a/onjava/excerpt/chap_07/index2.html
Btw, please post questions like these to the user list, not the dev
list, so that other users can help you or learn something from it.
Tom
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org
Re: JDO with CMT.
Posted by Brian McCallister <br...@chariotsolutions.com>.
On Feb 4, 2005, at 5:29 PM, Armin Waibel wrote:
> currently you can't use the OJB-JDO prototype in managed enviroments,
> because JTA integration is not supported (so JDO can't participate in
> JTA-tx).
> I recommend to use another open-source JDO implementation.
JPOX is pretty good.
-Brian
>
> regards,
> Armin
>
>
> Ramaswamy, Muthu wrote:
>> Hi All-
>> Currently I am trying to use Apache/OJB with JDO support in Session
>> Beans, using Container Manager Transaction(CMT) in Websphere 5.1.
>> When I executed the Session Bean, I get the following error:
>> "Exception data: javax.jdo.JDOUserException: Transaction is not
>> active."
>> I have attached below the sample code:
>> //Setting up the Bean
>> AuthUserJDO usr = new AuthUserJDO();
>> usr.setUsr_login("cocoon");
>> usr.setUsr_fullname("Demo");
>> usr.setUsr_password("moth");
>> usr.setUsr_email("xyz@abc.org");
>> //Get a PersistentManager PersistenceManagerFactory factory = new
>> OjbStorePMF(); //factory.
>> PersistenceManager manager = factory.getPersistenceManager(); //get
>> the manager.
>> manager.makePersistent(usr); //make persistent.
>> manager.close(); //close the manager.
>> I am new to Apache/OJB. Is there an example working program that
>> shows how to use JDO with CMT inside Session Bean? Any code sample
>> would help to resolve this issue.
>> Appreciate your time. Thanks.,
>> -Muthu
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-dev-help@db.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org
Re: JDO with CMT.
Posted by Armin Waibel <ar...@apache.org>.
Hi Muthu,
currently you can't use the OJB-JDO prototype in managed enviroments,
because JTA integration is not supported (so JDO can't participate in
JTA-tx).
I recommend to use another open-source JDO implementation.
regards,
Armin
Ramaswamy, Muthu wrote:
> Hi All-
>
> Currently I am trying to use Apache/OJB with JDO support in Session Beans, using Container Manager Transaction(CMT) in Websphere 5.1.
>
> When I executed the Session Bean, I get the following error:
>
> "Exception data: javax.jdo.JDOUserException: Transaction is not active."
>
> I have attached below the sample code:
>
> //Setting up the Bean
> AuthUserJDO usr = new AuthUserJDO();
> usr.setUsr_login("cocoon");
> usr.setUsr_fullname("Demo");
> usr.setUsr_password("moth");
> usr.setUsr_email("xyz@abc.org");
>
> //Get a PersistentManager
> PersistenceManagerFactory factory = new OjbStorePMF(); //factory.
> PersistenceManager manager = factory.getPersistenceManager(); //get the manager.
> manager.makePersistent(usr); //make persistent.
> manager.close(); //close the manager.
>
> I am new to Apache/OJB. Is there an example working program that shows how to use JDO with CMT inside Session Bean? Any code sample would help to resolve this issue.
>
> Appreciate your time. Thanks.,
>
> -Muthu
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-dev-help@db.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org