-
1. datasource.xml needed?
jaikiran Feb 2, 2011 2:41 AM (in response to nimo22)You'll get connection pooling if you use a datasource.
-
2. datasource.xml needed?
jaikiran Feb 2, 2011 2:41 AM (in response to nimo22)By the way, it's *-ds.xml file which is used for datasource configuration in JBoss AS.
-
3. datasource.xml needed?
nickarls Feb 2, 2011 2:42 AM (in response to jaikiran)Is @DataSourceDefinition pooled and deployed as a "real" DS?
-
4. datasource.xml needed?
jaikiran Feb 2, 2011 2:45 AM (in response to nickarls)Nicklas Karlsson wrote:
Is @DataSourceDefinition pooled and deployed as a "real" DS?
Yes, internally in JBoss AS the @DataSourceDefinition is converted to the JBoss specific datasource (a local-tx-datasource, if I remember correctly).
-
5. datasource.xml needed?
nickarls Feb 2, 2011 2:46 AM (in response to jaikiran)Recall it it's it scoped to definining application or free for everbody to use?
-
6. datasource.xml needed?
jaikiran Feb 2, 2011 2:51 AM (in response to nickarls)Nicklas Karlsson wrote:
Recall it it's it scoped to definining application or free for everbody to use?
The spec allows the user to specify in which JNDI namespace it gets bound:
Java EE6 Spec, section EE.5.17 DataSource Resource Definition:
The DataSource resource may be defined in any of the JNDI namespaces described in Section EE.5.2.2, “Application Component Environment Namespaces”. For example, a DataSource resource may be defined:
- in the java:comp namespace, for use by a single component
- in the java:module namespace, for use by all components in a module
- in the java:app namespace, for use by all components in an application
- in the java:global namespace, for use by all applications.
-
7. Re: datasource.xml needed?
nimo22 Feb 2, 2011 2:56 AM (in response to jaikiran){quote}You'll get connection pooling if you use a datasource.{quote}
So if I want to use connection pooling in Jboss AS, I have to use a additional file, namely the xy-ds.xml, even I have also declared my
connection-url, driver-class, user-name and password via the JPA-standard property names in persistence.xml? Am I right?
Is this also in glassfish or other application servers?
It's possible in JPA2 to use one place to configure my datasource (persistence.xml), so I do not need to care of another file (xy-ds.xml).But if I want connectin pooling, then I need a xy-ds.xml.
Would it be possible (or senseful), if Jboss took the needed properties for connection pooling from persistence.xml?
Thus, we dont need a xy-ds.xml anymore.
-
8. Re: datasource.xml needed?
nickarls Feb 2, 2011 2:57 AM (in response to nimo22)The @DataSourceDefinition discussed above should liberate you from this extra file.
-
9. Re: datasource.xml needed?
jaikiran Feb 2, 2011 3:00 AM (in response to nimo22)nimo stephan wrote:
You'll get connection pooling if you use a datasource.
So if I want to use connection pooling in Jboss AS, I have to use a additional file, namely the xy-ds.xml, even I have also declared my
connection-url, driver-class, user-name and password via the JPA-standard property names in persistence.xml? Am I right?
If you are using a datasource, you don't have to use those connection properties in the persistence.xml. Instead you just use the <jta-data-source> element in the persistence.xml and point it to the jndi name of your datasource.
nimo stephan wrote:
Is this also in glassfish or other application servers?
The way you create/configure the datasource in glassfish and other application servers will be different. But pointing to the datasource in the persistence.xml is the same way as I explained a few lines back.
-
10. Re: datasource.xml needed?
jaikiran Feb 2, 2011 3:01 AM (in response to nickarls)Nicklas Karlsson wrote:
The @DataSourceDefinition discussed above should liberate you from this extra file.
Yes, that's one other option for Java EE6 applications (If you are using xmls to define the data-source, then remember to use the correct xsd in the web.xml or ejb-jar.xml file).
-
11. Re: datasource.xml needed?
nimo22 Feb 2, 2011 3:08 AM (in response to jaikiran)By the way, I do use "java:/MY_DS" in my persistence.xml, so I do not use java:comp, java:module, java:app, java:global namespace. But it works. Should I change it to "java:app/MY_DS" ?
Another question is, I use JTA-Transaction (by default) and not transaction-type="RESOURCE_LOCAL", how does it relate to local-tx-datasource in my xy-ds.xml ?
my pu:
<persistence-unit name="MY_PU">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:/MY_DS</jta-data-source>
my xy-ds.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE datasources
PUBLIC "-//JBoss//DTD JBOSS JCA Config 1.5//EN"
"http://www.jboss.org/j2ee/dtd/jboss-ds_1_5.dtd">
<datasources>
<local-tx-datasource>
<jndi-name>MY_DS</jndi-name>
-
12. Re: datasource.xml needed?
jaikiran Feb 2, 2011 3:15 AM (in response to nimo22)nimo stephan wrote:
By the way, I do use "java:/MY_DS" in my persistence.xml, so I do not use java:comp, java:module, java:app, java:global namespace. But it works. Should I change it to "java:app/MY_DS" ?
No, stick to java:/My_DS since you haven't configured a @DataSourceDefinition as specified by Java EE6 spec.
nimo stephan wrote:
Another question is, I use JTA-Transaction (by default) and not transaction-type="RESOURCE_LOCAL", how does it relate to local-tx-datasource in my xy-ds.xml ?
The (JBoss specific) local-tx-datasource and the transaction-type in the persistence.xml are completely different things. See the JPA spec for more details on what transaction-type attribute means. As for the local-tx-datasource, see this http://community.jboss.org/wiki/configdatasources
-
13. Re: datasource.xml needed?
nimo22 Feb 2, 2011 3:21 AM (in response to jaikiran){quote}If you are using a datasource, you don't have to use those connection properties in the persistence.xml. Instead you just use the <jta-data-source> element in the persistence.xml and point it to the jndi name of your datasource.{quote}
Yes, I know, I have used that this way. I was just wondering because jpa2 does specified these properties, so I have thought that I do not need xy-ds.xml anymore.
The fact is:
When using JBOSS AS and when I want to use connection pooling, then I have to use a datasource even if I declared the SAME datas (connection-url, driver-class, user-name, password) already in a standardized JPA2-manner.
By the way, I guess, the xy-ds.xml is not standard-conform because we have to use the doctype "//JBoss//DTD JBOSS JCA Config 1.5//EN", hence xy-ds.xml cannot be used in other JEE-Containers -xy-ds.xml ispure jboss-specific.
The question is:
Would it be senseful, if Jboss AS takes the values needed for connection pooling out of the persistence.xml. If so, then we can deprecate xy-ds.xml;)
-
14. Re: datasource.xml needed?
nickarls Feb 2, 2011 3:23 AM (in response to nimo22)(you don't have to use the connection-url properties in your persistence.xml, a jndi name that matches the one defined in the -ds is enough.)