users@glassfish.java.net

Re: JNDI namespaces and serialization while binding

From: <glassfish_at_javadesktop.org>
Date: Thu, 06 Mar 2008 11:03:27 PST

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