[forge-issues] [JBoss JIRA] (FORGE-1520) Use Java EE 7 Default Datasource in persistence.xml

Antonio Goncalves (JIRA) issues at jboss.org
Thu Sep 10 16:50:00 EDT 2015


     [ https://issues.jboss.org/browse/FORGE-1520?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Antonio Goncalves updated FORGE-1520:
-------------------------------------
    Parent Issue: FORGE-2277  (was: FORGE-1491)


> Use Java EE 7 Default Datasource in persistence.xml
> ---------------------------------------------------
>
>                 Key: FORGE-1520
>                 URL: https://issues.jboss.org/browse/FORGE-1520
>             Project: Forge
>          Issue Type: Sub-task
>          Components: Scaffold
>    Affects Versions: 2.0.0.CR2
>            Reporter: Antonio Goncalves
>             Fix For: 3.x Future
>
>
> If I create project with default values I get the following {{persistence.xml}} :
> {code}
> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
> <persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.1" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
>   <persistence-unit name="forge-default" transaction-type="JTA">
>     <description>Forge Persistence Unit</description>
>     <jta-data-source>java:jboss/datasources/ExampleDS</jta-data-source>
>     <exclude-unlisted-classes>false</exclude-unlisted-classes>
>     <properties>
>       <property name="javax.persistence.schema-generation.database.action" value="drop-and-create"/>
>       <property name="javax.persistence.schema-generation.scripts.action" value="drop-and-create"/>
>       <property name="javax.persistence.schema-generation.scripts.create-target" value="pluralsight-persistenceCreate.ddl"/>
>       <property name="javax.persistence.schema-generation.scripts.drop-target" value="pluralsight-persistenceDrop.ddl"/>
>     </properties>
>   </persistence-unit>
> </persistence>
> {code}
> This code doesn't work in GlassFish because of the Datasource {{java:jboss/datasources/ExampleDS}}. 
> This {{persistence.xml}} is JPA 2.1 compatible, so you should use the default Datasource that is portable accross application server : just get rid of the {{<jta-data-source>}} element and it will work on both GlassFish and WildFly 8 CR1.



--
This message was sent by Atlassian JIRA
(v6.4.11#64026)


More information about the forge-issues mailing list