im working on an existing system and need to have my spring transaction manager attach to a thread thats being spawned off of a master job thread. i keep getting this exception
org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here
at org.springframework.orm.hibernate3.SpringSessionContext.currentSession(SpringSessionContext.java:63)
at org.hibernate.impl.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:687)
at parity.model.datamapping.RefreshTask.execute(RefreshTask.java:95)
at com.paritysys.tasks.ASyncTask$1.run(ASyncTask.java:48)
at java.lang.Thread.run(Thread.java:662)
ive annotated everything i can think of with the transactional annotation and i still cant get this error to clear.
what am i missing
my method
@TransactionAS400
@TransactionScores
public void refresh() {
ASyncTaskWorker worker = new ASyncTaskWorker() {
public void progress(double percentage, String message) {
logger.debug(String.format("%.2f - %s", percentage, message));
}
public void handleException(Throwable e) {
try {
status.allowUpdating(property.getSchema());
} catch (Exception b) {
// consume
}
logger.error("Failed to complete the refresh task", e);
}
public void done(boolean success) {
status.allowUpdating(property.getSchema());
logger.debug(String.format(
"Reset updating status to default for %s",
property.getSchema()));
}
};
RefreshTask refTask = ServiceProviderContext.find(RefreshTask.class);
refTask.init(property, worker);
ASyncTaskHandler.getInstance().add(refTask);
ASyncTaskHandler.getInstance().process();
}