So far I know, the real object that is stored in JNDI must be serializable. There is the class javax.naming.Reference that can be use to "represent" an object. Then the reference can be bound to implementation of javax.naming.spi.ObjectFactory that can be used to "reconstruct" the object based on the reference.
You can maybe have a look at JBoss' class
http://www.jdocs.com/jboss/4.0.4/org/jboss/ejb3/NonSerializableFactory.html.
This class holds a hashmap with the reference stored in JNDI and the real object. It can then "resolve" the reference back to the real object.
I know that Hibernate supports binding the SessionFactory in jndi (at least with JBoss with a special MBean, if I'm right). <session-factory name="java:hibernate/SessionFactory">. Why would you like to bind a session instance?
[Message sent by forum member 'ewernli' (ewernli)]
http://forums.java.net/jive/thread.jspa?messageID=262734