You've probably forgot to specifie the jndi-name in your deployments files for one EJB for example.
In case you are using EJB3/Hibernate with jboss, this means that you have not explicit specified to bind the EntityManagerFactory (aka SessionFactory) to JNDI. So you cannot look up for the SessionFactory in JNDI.
To register the SessionFactory in JNDI you have to specify it in persistence.xml via following entry:
<property name="hibernate.session_factory_name" value="java:hibernate/SessionFactory" />
So if I have not specified a in the <persistence-unit>, would JBoss default it to hibernate? What other options do I have?
Should I specify a explicitly to avoid ambiguity?
In EJB3 you need only in rare circumstances use of a SessionFactory. Mostly you would inject a EntityManager(-Factory) directly via annotations in your Beans.
So in most of your applications you don't need a SessionFactory and there there would be no need to register the name of the SF in JNDI.
There are some application-points under EJB3, where annotation-based injection of EntityManager(-Factory) isn't possible. In such a case you can lookup for the SessionFactory in JNDI.
An Exammple for the need of a SessionFactory are the Hibernate EventListeners. Inside such a Listener , if you possibly want to make a db-query, ejb3-injection of EntityManager will not work there, because Hibernate Listeners are no EJB3-components. But you can lookup for the (registered) SF and use this.
That made sense. Thanks Rhodan76