Re: rendering a page for an email: org.hibernate.HibernateException: createCriteria is not valid without active transaction

2010-09-07 Thread Jeremy Thomerson
On Fri, Sep 3, 2010 at 12:10 PM, Fernando Wermus
fernando.wer...@gmail.comwrote:

 Hi all,
 I have coded the following to render a mail,


 Application app;
 try{
 app=MyApplication.get();
 }catch(Exception e){
 app=new WicketTester().getApplication();
 }
 final Application app2=app;
 final ExecutorService service = new ScheduledThreadPoolExecutor(1) {
 @Override
 protected void beforeExecute(final Thread t, final Runnable r) {
 Application.set(app2);
 };
 @Override
 protected void afterExecute(final Runnable r, final Throwable t) {
 Application.unset();
 }
 };
 service.submit(new ThreadMail(destinatarios, clazz, p));

 But, I got a org.hibernate.HibernateException: createCriteria is not valid
 without active transaction
 when I tried to load an entity in a model to be used in the PageMail.

 How can I attach the Transaction to the thread to get this working?

 thanks in advance

 --
 Fernando Wermus.

 www.linkedin.com/in/fernandowermus



This has nothing in particular to do with Wicket, and would be hard to
answer without knowing the details of what you are doing for transaction
management.

-- 
Jeremy Thomerson
http://www.wickettraining.com


rendering a page for an email: org.hibernate.HibernateException: createCriteria is not valid without active transaction

2010-09-03 Thread Fernando Wermus
Hi all,
 I have coded the following to render a mail,


Application app;
try{
app=MyApplication.get();
}catch(Exception e){
app=new WicketTester().getApplication();
}
final Application app2=app;
final ExecutorService service = new ScheduledThreadPoolExecutor(1) {
@Override
protected void beforeExecute(final Thread t, final Runnable r) {
Application.set(app2);
};
@Override
protected void afterExecute(final Runnable r, final Throwable t) {
Application.unset();
}
};
service.submit(new ThreadMail(destinatarios, clazz, p));

But, I got a org.hibernate.HibernateException: createCriteria is not valid
without active transaction
when I tried to load an entity in a model to be used in the PageMail.

How can I attach the Transaction to the thread to get this working?

thanks in advance

-- 
Fernando Wermus.

www.linkedin.com/in/fernandowermus