[Logo] Terracotta Discussion Forums (LEGACY READ-ONLY ARCHIVE)
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
[Expert]
Quartz + hibernate alone  XML
Forum Index -> Quartz
Author Message
kesa1974

neo

Joined: 12/03/2009 12:28:53
Messages: 5
Offline

Hi,
I am trying to integrate Quartz with Hibernate (no SPRING). But when ever I do this, I get UserTransaction exceptions.

Is there a reference implementation for Quartz integration with just Hibernate alone??

Reply back to kesavramesh@gmail.com

Regards

Ramesh Kesavanarayanan
[Email]
jhouse

seraphim
[Avatar]
Joined: 11/06/2009 15:29:56
Messages: 1703
Offline


Are you using an App Server with a TM? Are you starting a UserTransaction before invoking methods (and committing after)?

There's nothing special you should have to do/setup other than the above.

e.g.:

UserTransaction utx = context.lookup("java:comp/UserTransaction");

utx.begin();

// do stuff, e.g. with hibernate

scheduler.scheduleJob();

// do stuff, e.g. with hibernate

utx.commit();



Of course the begin(), ccommit() etc on the UserTransaction may also be done "behind the scenes" by Hibernate, depending upon how you are using it's transaction and session model.
kesa1974

neo

Joined: 12/03/2009 12:28:53
Messages: 5
Offline

Yes, I am using weblogic 10.0 with hibernate.

Problem is that I have a stateless Session Bean which calls the job to insert / update a record into the database.

This job then internally invokes the Hibernate Sessions to do this.

But the problem here is when I do the same way as you have said, I get an exception stating that "UserTransaction" not bound.

I changed the property in the Quartz.properties
org.quartz.scheduler.wrapJobExecutionInUserTransaction = true

but then also I am not able to synchronize my transactions with that of the hibernate transactions. Wondering if you have any reference or pointers to the same.

Regards

Ramesh Kesavanarayanan
[Email]
steve

ophanim

Joined: 05/24/2006 14:22:53
Messages: 619
Offline

You could use the Terracotta clustering for quartz and avoid the problem altogether. It's in beta now and releasing quite soon

Want to post to this forum? Join the Terracotta Community
kesa1974

neo

Joined: 12/03/2009 12:28:53
Messages: 5
Offline

I did not get your answer. Could you eloborate on this?

Regards

Ramesh Kesavanarayanan
[Email]
steve

ophanim

Joined: 05/24/2006 14:22:53
Messages: 619
Offline

I think I miss read your post. You aren't using the DB to cluster quartz so what I said won't help you. Sorry.

Want to post to this forum? Join the Terracotta Community
kesa1974

neo

Joined: 12/03/2009 12:28:53
Messages: 5
Offline

In fact FYI, I started to use EJBTimer as an alternative initially before venturing into Quartz and I see the same kind of behaviour of "cannot synchronize" the user transactions.

I some how read it in the post that the file "UserTransactionHelper.java" in the package org.quartz.ee.jta
has the following lines of code
public static final String DEFAULT_USER_TX_LOCATION = "java:comp/UserTransaction";

which needs to be changed to
public static final String DEFAULT_USER_TX_LOCATION = "UserTransaction";

and that should solve the issue, but the problem is that I am not able to compile the source.


Regards

Ramesh Kesavanarayanan
[Email]
jhouse

seraphim
[Avatar]
Joined: 11/06/2009 15:29:56
Messages: 1703
Offline


You can change it through configuration in the quartz.properties file.

Code:
 org.quartz.scheduler.userTransactionURL: UserTransaction
 
 
Forum Index -> Quartz
Go to:   
Powered by JForum 2.1.7 © JForum Team