]
Antonio Goncalves commented on FORGE-1686:
------------------------------------------
Yes but that means that without a {{jpa-setup}} the code doesn't work anymore. Should
it be "by default the app runs on JBoss/Hibernate and if you are not happy about it,
then set it up" ?
Not setting up a provider in JPA doesn't add properties in
persistence.xml
--------------------------------------------------------------------------
Key: FORGE-1686
URL:
https://issues.jboss.org/browse/FORGE-1686
Project: Forge
Issue Type: Bug
Components: Java EE
Affects Versions: 2.2.0.Final
Reporter: Antonio Goncalves
Priority: Critical
Fix For: 2.x Future
If you create a project with a few entities and then scaffold a JSF front end without
setting up jpa (command {{jpa-setup}}), the generated {{persistence.xml}} looks like this
:
{code}
<?xml version="1.0" encoding="UTF-8"
standalone="yes"?>
<persistence
xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.0"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="test-persistence-unit"
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>
</persistence-unit>
</persistence>
{code}
In the {{pom.xml}}, the Hibernate dependency has been added, so it's like Hibernate
is the default.... but not Hibernate properties... so, unfortunattelly, the webapp
doesn't work. Once deployed on JBoss it cannot create the tables... because there are
some properties missing. If you run {{jpa-setup --provider Hibernate}}, then you have what
you need :
{code}
<?xml version="1.0" encoding="UTF-8"
standalone="yes"?>
<persistence
xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.0"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="test-persistence-unit"
transaction-type="JTA">
<description>Forge Persistence Unit</description>
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:jboss/datasources/ExampleDS</jta-data-source>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="hibernate.hbm2ddl.auto"
value="create-drop"/>
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.format_sql" value="true"/>
<property name="hibernate.transaction.flush_before_completion"
value="true"/>
<property name="hibernate.dialect"
value="org.hibernate.dialect.HSQLDialect"/>
</properties>
</persistence-unit>
</persistence>
{code}
On one hand, Hibernate has been added to the pom, and on the other hand it hasn't
beed added in the persistence.xml... So, by default, not executing {{jpa-setup}} should be
equivalent as executing {{jpa-setup --provider Hibernate}}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: