Todd Sandor [http://community.jboss.org/people/toddler] created the discussion

"EJB3 annotation question ..."

To view the discussion, visit: http://community.jboss.org/message/606338#606338

--------------------------------------------------------------
Hi ...
I am new to JBoss, EJB and EJB3 ...on a steep learning curve...

We are moving to JBoss 5.1.0 from 4.3.0 and as part of this would like to move 
from EJB to EJB3.  I just read the following article: "EJB 3: From legacy 
technology to secret weapon" by Adam Bien here:
 http://www.javaworld.com/javaworld/jw-10-2008/jw-10-ejb3.html 
http://www.javaworld.com/javaworld/jw-10-2008/jw-10-ejb3.html

For our EJB to EJB3 change, I've investigating using annotations as described 
in the above article. In our existing EJB implementation, we create the remote 
interface, home interface, bean class, deployment descriptors (ejb-jar.xml, 
jboss.xml), etc.

In the above article, it talks about using Declarative injection for the 
client, using

@EJB
private Service service;

and the container injects the ClientBean, etc...

Our client implementation is multi-threaded, performs async requests and uses a 
per package InterfaceMgr that creates a separate bean per thread (uses a MAP 
...).
We use stateful sessions.  Had to do this as got EJBExceptions related to a 
Stateful bean being used with a different tx context (async requests via thread 
pool)....

So when a bean needs to be used the one doesn't existing for the 
thread/package, we create a new bean using the "Home".create() call. Code 
snippet ...

  Object lNarrowTo = initialContext_.lookup(EJB_NAME);
  MYCLASSHome = (EjbMYCLASSHome)             
PortableRemoteObject.narrow(initialContext_.lookup(EJB_NAME),
                    EjbMYCLASSHome.class);
...
        bean = (EjbMYCLASS) PortableRemoteObject.narrow(
                MYCLASSHome.create(...),
                EjbMYCLASS.class);

Is it possible to create a new bean when required using an annotation, when we 
don't have the "Home" interface ...?  If so, how?

The idea being using annotations for everything and not manually (via tools) 
creating the remote interface, home interface, bean class, deployment 
descriptors (ejb-jar.xml, jboss.xml), etc. as we currently do.  I know we can 
continue to use all these artifacts, but ...

Any suggested articles, tutorials, books I should read to come up to speed on 
this technology...
Thanks...
--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/606338#606338]

Start a new discussion in EJB3 at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2029]

_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to