-
1. Re: Problem with resource-mapping
waynebaylor Nov 22, 2007 2:15 PM (in response to hdmonty)do you mean you want to use the same deployment descriptor for each bean, or that you want the beans to have the same code and just change the descriptor?
-
2. Re: Problem with resource-mapping
hdmonty Nov 22, 2007 5:16 PM (in response to hdmonty)I mean that the Resource-name('myDB') is mapped on a datasource ear-wide. First I thought you can make this in a jboss-app.xml or applikation.xml like you can do that in a jboss-web.xml but that doesnt work.
My problem is, I would like to avoid to build a deployment descriptor for twenty or more beans in an applikation. With my beans I want to make up reusable code. So I decided, that every datasource gets the name 'myDB' and is mapped to the global jndi-name 'java:/MyDefaultDS'. Now I have the problem that more than one applikation is deployed on a server with different databases. I can manage this with a deployment descriptor in each bean but that is to complicated.
I hope the problem is more perspicuous even if my english is a disaster. -
3. Re: Problem with resource-mapping
waynebaylor Nov 23, 2007 3:35 PM (in response to hdmonty)i would make each bean that needs a datasourse use a local jndi lookup instead of a global one. since you only have one jar you will only need one ejb-jar.xml and one jboss.xml.
doing it this way you can keep your bean code the same, for example all lookups could be:DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/MyDS");
then in the jboss.xml you can map the lookup to the proper data source on a per bean basis. -
4. Re: Problem with resource-mapping
hdmonty Nov 26, 2007 3:58 AM (in response to hdmonty)How does look the mapping in a jboss.xml and ejb-jar.xml?