-
Bug
-
Resolution: Done
-
Critical
-
2.2.0.Final
-
None
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 :
<?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>
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 :
<?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>
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