users@glassfish.java.net

CDI Instances and EJB and Glassfish

From: <glassfish_at_javadesktop.org>
Date: Sat, 17 Jul 2010 22:39:36 PDT

I have an interface like this:
[code]
public interface DAO {

}
[/code]

And another interface like this:
[code]
public interface Sessions extends DAO {

}
[/code]

And a local session bean that implements both, like this:
[code]
@Local({ Sessions.class, DAO.class })
@Stateless
public class BozoBean implements Session {

}
[/code]

Then, in another class in the same ear, I inject an Instance<DAO> like this:
[code]
private Instance<DAO> dao;
[/code]

According to the Javadoc and the CDI specification, I should be able to iterate over it like this:
[code]
for (final DAO d : dao) {
  if (d != null) {
    // do something with d
  }
}
[/code]

All relevant archives contain empty META-INF/beans.xml files.

However, when I do this, there are no elements in the Iterable Instance. Why not? Additionally, dao.isUnsatisified() returns true. What's going on? What should I check?

Best,
Laird
[Message sent by forum member 'ljnelson']

http://forums.java.net/jive/thread.jspa?messageID=477877