I was wondering if anyone out there can shed some light on an issue I am facing in JEE. I basically have a setup that is a Stateless Session Bean. It calls a helper class which in turn calls another helper wich in turn acts upon an Entity. I have written many tests to try to get this to work and the only success I have had to date is passing the entity from the SLSB all the way through the exection path so that it can eventually be used.
When I try to name the persistence context on the SLSB and then do a JNDI lookup in what is essentially a helper class I consistently get name not found. The following is an example of what I am talking about
@PersistenceContext(name="persistence/em")
@Stateless(mappedName = "com/zaplet/SequenceEnitity")
public class SequenceManager implements SequenceManagerRemote {
private SequenceGeneratorDAO _sequenceGenerator;
public SequenceManager() {
_sequenceGenerator = SequenceGeneratorDAO.singleton;
}
public NewID getNewId(NewID id) {
return _sequenceGenerator.getNewId(id);
}
}
the helper class that I eventually get to is
public class ManagedSequenceGenerator implements SequenceGeneratorService {
EntityManager em = null;
public ManagedSequenceGenerator() {
try {
Context ic = new InitialContext();
em = (EntityManager) ic.lookup("java:comp/env/persistence/em");
System.out.println("What the ???");
} catch (NamingException e) {
System.out.println("What the ###");
}
}
public void create(Sequence sequenceEntity) {
entityManager.persist(sequenceEntity);
}
}
Can someone please clarify what I am doing wrong, I have even tried a jndi lookup of "persistence/em" , is there a basic principle I do not understand ???
thanks
tony
[Message sent by forum member 'grinch64' (grinch64)]
http://forums.java.net/jive/thread.jspa?messageID=324684