-
1. Re: Lookup of Local interface from POJO...
jcordes Nov 14, 2003 11:01 AM (in response to wesleyhall)Yes, it is possible when both the POJO and your EJB's reside in the same vm. What you're trying to do, is to use the Business Delegate Pattern to decouple business logic and underlying persistence from the front-end (i.e. web). I'm making heavy use of it so it for sure works ;-), although I still prefer to use a session bean as a facade. Nevertheless it should work with entity beans like this:
Properties p = new Properties();
// init properties here ...
InitialContext ctx = new InitialContext(p);
MyEntityLocalHome myEntityHome = (MyEntityLocalHome)ctx.lookup("java:comp/env/ejb/MyEntityLocalHome");
I've realized an alternative implementation in Hibernate for my project (currently for reading only) and plugged it in seamlessly by using Business Delegates and configuration files, cool ...
HTH,
Jochen. -
2. Re: Lookup of Local interface from POJO...
darranl Nov 17, 2003 7:38 AM (in response to wesleyhall)If you are running inside the JBoss JVM replace
Properties p = new Properties();
// init properties here ...
InitialContext ctx = new InitialContext(p);
with
InitialContext ctx = new InitialContext();
The internal JNDI configuration will be used to ensure that your calls don't go over RMI.