Ale,
    I got a

org.hibernate.HibernateException: createCriteria is not valid without active
transaction

because the page that I am trying to render need to get an entity using
hibernate.

how could I solve this situation?

thanks in advance

On Fri, Jul 30, 2010 at 5:38 PM, Alex Objelean <[email protected]>wrote:

>
> Yes, the solution I've mentioned in previous post should solve your
> problem.
>
> Alex
>
> On 30 July 2010 22:44, Fernando Wermus-3 [via Apache Wicket] <
> [email protected]<ml-node%[email protected]>
> <ml-node%[email protected]<ml-node%[email protected]>
> >
> > wrote:
>
> > Ale,
> >    Related to what you have mentioned. I render mails with some
> > mockHTTPrequest and mockeHTTPResponse, etc. But, I need to render mails
> in
> > a
> > different thread than wicket's one. I have another servlet that runs
> > Blazeds
> > (Flex) where I also need to render some mails, but  I got  "There is no
> > application
> > attached to current thread...". According to what you mentioned, could I
> > solve this issue?
> >
> > thanks in advance.
> >
> > On Fri, Jul 30, 2010 at 5:46 AM, Alex Objelean <[hidden email]<
> http://user/SendEmail.jtp?type=node&node=2308410&i=0>>wrote:
> >
> >
> > >
> > > There was a long discussion about this. One of the proposal was to use
> > > InheritableThreadLocal which would solve this problem, but there was a
> > lot
> > > of concerns about this approach.
> > >
> > > The solution I have found was this:
> > > If you create the thread with ExecutorService, you could do the
> > following:
> > >
> > >    final ExecutorService service = new ScheduledThreadPoolExecutor(1) {
> > >      @Override
> > >      protected void beforeExecute(final Thread t, final Runnable r) {
> > >        Application.set(app);
> > >      };
> > >      @Override
> > >      protected void afterExecute(final Runnable r, final Throwable t) {
> > >        Application.unset();
> > >      }
> > >    };
> > >
> > > and execute you thread like this:
> > > service.submit(new Runnable() {
> > >            @Override
> > >            public void run() {
> > >              //do stuff
> > >            }
> > >          });
> > >
> > > This will ensure that Application is accessible from within newly
> created
> >
> > > thread.
> > >
> > > Alex
> > > --
> > > View this message in context:
> > >
> >
> http://apache-wicket.1842946.n4.nabble.com/Localizer-in-a-new-Thread-tp2307306p2307732.html
> <
> http://apache-wicket.1842946.n4.nabble.com/Localizer-in-a-new-Thread-tp2307306p2307732.html?by-user=t
> >
> > > Sent from the Wicket - User mailing list archive at Nabble.com.
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [hidden email]<
> http://user/SendEmail.jtp?type=node&node=2308410&i=1>
> > > For additional commands, e-mail: [hidden email]<
> http://user/SendEmail.jtp?type=node&node=2308410&i=2>
> > >
> > >
> >
> >
> > --
> > Fernando Wermus.
> >
> > www.linkedin.com/in/fernandowermus
> >
> >
> > ------------------------------
> >  View message @
> >
> http://apache-wicket.1842946.n4.nabble.com/Localizer-in-a-new-Thread-tp2307306p2308410.html
> > To unsubscribe from RE: Localizer in a new Thread, click here<
> http://apache-wicket.1842946.n4.nabble.com/subscriptions/Unsubscribe.jtp?code=YWxleC5vYmplbGVhbkBnbWFpbC5jb218MjMwNzczMnwtNDA5MTE1Njc3
> >.
> >
> >
> >
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Localizer-in-a-new-Thread-tp2307306p2308459.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>



-- 
Fernando Wermus.

www.linkedin.com/in/fernandowermus

Reply via email to