[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - Re: Referenced datasource not found with JBoss 5.0 (Beta4)

jaikiran do-not-reply at jboss.com
Tue Apr 15 04:17:02 EDT 2008

"depryf" wrote : 
  | I am going to try to add the references in the EJB context. This is not very simple because we don't currently have a ejb-jar.xml or jboss.xml file; we only use annotations to define our session beans. I can easily add those files, but I have to define every single EJB since they all access our database (and there are many of them). So it's kind of a pain. But I will work on that soon.

Since you are using annotations, you need not create those ejb-jar.xml or jboss.xml. In your EJBs you can add this @Resources class level annotation:

@Resources( {
  |         @Resource(type = DataSource.class, name = "app-specific/datasource", mappedName = "java:/app/datasource")
  |         })
  | public class MyBean implements MyInterface {

This is equivalent to having the resource-ref defined in the ejb-jar.xml and jboss.xml. 

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

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

More information about the jboss-user mailing list