i use @JndiInject(jndiName="xxx") on an private Field named "sessionFactory" of type org.hibernate.SessionFactory - this works great!
How do i inject an concrete org.hibernate.Session (long-lifed)?
@JndiInject(jndiName="xxx")
private SessionFactory sessionFactory;
private Session hibernateSession session = sessionFactory.openSession();
will create an NPE.
You can try @PostConstruct annotation to execute any kind of logic after all dependencies are injected:
@PostConstruct
private void initSession() {
session = sessionFactory.openSession();
}