Hello everyone ... after reading the Dependency Injection book (love
this book btw) im trying to put up a project with Guice , Warp and
Hibernate ... I have been trying a lot of thing the last week  ... and
i cant make it work ..
im getting :
org.hibernate.HibernateException: No session currently bound to
execution context (<property
name="current_session_context_class">managed</property>)
or
org.hibernate.SessionException: Session is closed! (<property
name="current_session_context_class">thread</property>)

The configure of guice is like
protected void configure() {
        install(PersistenceService.usingHibernate().across
(UnitOfWork.REQUEST).buildModule());
        bind(Configuration.class).toInstance(new
AnnotationConfiguration().configure());
        ...
       bind(MyInitializer.class).asEagerSingleton();
}

the MyInitializer.class is like :
..
@Inject MyInitializer(PersistenceService service) {
                service.start();
        }
..

and im using it like:

private final Provider<Session> session;

@Inject
    public HibernateFooManager(Provider<Session> session) {
        this.session = session;
    }

@Transactional(type=TransactionType.READ_ONLY)
    public List<Foo> search(Application app) {
        Criteria criteria = session.get().createCriteria
(Pattern.class);
        criteria.add((Expression.eq("idApp",app)))
                .add(Expression.ne("isCon", false))
                .addOrder(Order.desc("priority"));
        return criteria.list();
    }


Can someone help me , to see what  im doing wrong?

-- 
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-guice?hl=en.

Reply via email to