Skip to main content

[javaee-spec issues] [JIRA] Created: (JAVAEE_SPEC-30) JPA persistence.xml should integrate with @DataSourceDefinition and web.xml data-source definition

  • From: "lincolnbaxter (JIRA)" <jira-no-reply@...>
  • To: issues@...
  • Subject: [javaee-spec issues] [JIRA] Created: (JAVAEE_SPEC-30) JPA persistence.xml should integrate with @DataSourceDefinition and web.xml data-source definition
  • Date: Mon, 9 Sep 2013 19:07:07 +0000 (UTC)
  • Auto-submitted: auto-generated

JPA persistence.xml should integrate with @DataSourceDefinition and web.xml 
data-source definition
--------------------------------------------------------------------------------------------------

                 Key: JAVAEE_SPEC-30
                 URL: https://java.net/jira/browse/JAVAEE_SPEC-30
             Project: javaee-spec
          Issue Type: Improvement
         Environment: EE 6/7+
            Reporter: lincolnbaxter
            Assignee: ldemichiel


Datasources defined via @DataSourceDefinition allow @Resource injection of 
DataSource objects into application code. However, these data-sources are not 
integrated with the persistence.xml JPA configuration file. And attempted use 
of the custom defined DataSource in persistence.xml will result in deployment 
failure. The EE spec allow for interop between these features:

For a datasource definition:

{code}
@DataSourceDefinition(
         url = "jdbc:h2:mem:",
         className = "org.h2.jdbcx.JdbcDataSource",
         name = "java:global/jdbc/h2db",
         user = "sa",
         password = "")
{code}

The following persistence.xml should be valid:

{code}
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" ;
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
   xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence ;
http://www.oracle.com/webfolder/technetwork/jsc/xml/ns/persistence/persistence_2_1.xsd";>

   <persistence-unit name="default" transaction-type="JTA">
      <jta-data-source>java:global/jdbc/h2db</jta-data-source>
      <exclude-unlisted-classes>false</exclude-unlisted-classes>
   </persistence-unit>

</persistence>
{code}

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
https://java.net/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


[javaee-spec issues] [JIRA] Created: (JAVAEE_SPEC-30) JPA persistence.xml should integrate with @DataSourceDefinition and web.xml data-source definition

lincolnbaxter (JIRA) 09/09/2013

[javaee-spec issues] [JIRA] Commented: (JAVAEE_SPEC-30) JPA persistence.xml should integrate with @DataSourceDefinition and web.xml data-source definition

reza_rahman (JIRA) 09/09/2013

[javaee-spec issues] [JIRA] Commented: (JAVAEE_SPEC-30) JPA persistence.xml should integrate with @DataSourceDefinition and web.xml data-source definition

kithouna (JIRA) 09/12/2013
 
 
Close
loading
Please Confirm
Close