[jboss-user] [EJB 3.0] - Re: Accessing EntityManagerFactory/SessionFactory via JNDI s

matt10 do-not-reply at jboss.com
Wed Sep 3 07:03:10 EDT 2008


That works.

Thanks so much, jaikiran! :)

So the problem is that:..

  | NamingEnumeration<Binding> list = ctx.listBindings("persistence-units");
  | while (list.hasMore()) {
  |     Binding nc = (Binding)list.next();
  |     Object o = nc.getObject();
  |     ...
  | 

... does not return the same object as:


  | NamingEnumeration<Binding> list = ctx.listBindings("persistence-units");
  | while (list.hasMore()) {
  | 	Binding nc = (Binding)list.next();
  | 	Object o = ctx.lookup("persistence-units/" + nc.getName());
  |         ...
  | 

I didn't know this at all.

I was coding referring to Javadocs and some web examples only.. I usually only do a simple lookup in JNDI not scan it. I even read the JNI lookup source code in JBoss to see when and how javax.naming.Reference instances are resolved.

Another one to put down to experience.

Thanks.

Matt

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4173917#4173917

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4173917



More information about the jboss-user mailing list