Thiago H. de Paula Figueiredo escribió:
Em Mon, 25 May 2009 12:43:17 -0300, Antonio Fernández <amiguel.fernan...@gmail.com> escreveu:

Hi again,

Hi!

        * org.hibernate.HibernateException: No CurrentSessionContext
          configured!

The suggested way is to override getSession() to return something other than sessionFactory.getSession() or set a CurrentSessionContext in you SessionFactory (recommended). This section in the Hibernate documentation tells you why and how: http://docs.jboss.org/hibernate/stable/core/reference/en/html_single/#architecture-current-session.


. I tried with the three available values for property "hibernate.current_session_context_class", it only works with
value org.hibernate.context.ThreadLocalSessionContext.

However, a new problem

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

Hide uninteresting stack frames Stack trace

       * 
org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:338)

       * $Proxy68.createCriteria(Unknown Source)
       * 
br.com.arsmachina.dao.hibernate.ReadableDAOImpl.createCriteria(ReadableDAOImpl.java:267)

       * 
br.com.arsmachina.dao.hibernate.ReadableDAOImpl.findAll(ReadableDAOImpl.java:125)

       * 
br.com.arsmachina.dao.hibernate.GenericDAOImpl.findAll(GenericDAOImpl.java:94)

       * $UserDAO_1217e966a63.findAll($UserDAO_1217e966a63.java)
       * org.jwp.ic20.pages.admin.user.UserShowAll.getUsers(UserShowAll.java:39)

       * $PropertyConduit_1217e966a93.get($PropertyConduit_1217e966a93.java)

       * 
org.apache.tapestry5.internal.bindings.PropBinding.get(PropBinding.java:58)



My AppModule already includes the following contribution for decorating all the DAO services :

   @Match("*DAO")
public static <T> T decorateTransactionally(HibernateTransactionDecorator decorator, Class<T> serviceInterface,
                                               T delegate,
                                               String serviceId)
   {
       return decorator.build(serviceInterface, delegate, serviceId);
   }

So at this point would require a deeper understanding of tapestry-hibernate.


Greetings,
Antonio









A few changes in BaseHibernateDAO :

   - Replaced the import of class org.hibernate.classic.Session with
org.hibernate.Session.

Thanks for pointing me that. I've just fixed this in the Generic DAO-Hibernate branch. By the way, in the Maven repository, there is an improved 1.1 version there.

   - Add the org.hibernate.Session object as a new paremeter in all the
constructor methods.
   - Changes in class BaseHibernateDAO :

            Add new field of type org.hibernate.Session, that will be
initialized inside the constructor ( like the SessionFactory does )
Modify the method getSession(), returning the new field reference

These modifications aren't appropriate to *Generic* DAO-Hibernate, as they wouldn't work without Tapestry-IoC (for example, when you're building a desktop application or using Spring), and this package is meant to be independetly from Tapestry-IoC.



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to