Hi there!
I'm reading chapter 2 of Java Persistence with Hibernate and having problems to figure out why jpaconfiguration do not generate any pojo with hbm2java. No console error message. No output either. Only the hibernate.cfg.xml get created.
When I use jdbcconfiguration, as described in the book, everything works fine, but trying to use jpaconfiguration do not. And I read the documentation and cant figure out why.
I'm using MySQL.
Any help will be more than appreciated.
My ant script snippet:
Code:
[...]
<target name="reveng.entities" description="Produces Java entity classes in src directory">
<hibernatetool destdir="${basedir}/src">
<jpaconfiguration persistenceunit="helloworld" />
<hbm2hbmxml />
<!-- Export Hibernate XML files -->
<hbm2cfgxml />
<!-- Export a hibernate.cfg.xml file -->
<hbm2java ejb3="true" jdk5="true" />
</hibernatetool>
</target>
[...]
My persistence.xml
Code:
<persistence
xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
version="1.0">
<persistence-unit
name="helloworld">
<jta-data-source>java:/HelloWorldDS</jta-data-source>
<properties>
<property
name="hibernate.show_sql"
value="true"/>
<property
name="hibernate.format_sql"
value="true"/>
<property
name="hibernate.hbm2ddl.auto"
value="create"/>
<property
name="hibernate.c3p0.min_size"
value="5"/>
<property
name="hibernate.c3p0.max_size"
value="20"/>
<property
name="hibernate.c3p0.timeout"
value="300"/>
<property
name="hibernate.c3p0.max_statements"
value="50"/>
<property
name="hibernate.c3p0.idle_test_period"
value="3000"/>
</properties>
</persistence-unit>
</persistence>
The output log (when using jpaconfiguration):
Code:
Apache Ant version 1.7.1 compiled on June 27 2008
Buildfile: C:\AreaDeTrabalho\MeusProjetos\HelloWorldRevEng\build.xml
parsing buildfile C:\AreaDeTrabalho\MeusProjetos\HelloWorldRevEng\build.xml with URI = file:/C:/AreaDeTrabalho/MeusProjetos/HelloWorldRevEng/build.xml
Project base dir set to: C:\AreaDeTrabalho\MeusProjetos\HelloWorldRevEng
[antlib:org.apache.tools.ant] Could not load definitions from resource org/apache/tools/ant/antlib.xml. It could not be found.
Build sequence for target(s) `reveng.entities' is [reveng.entities]
Complete build sequence is [reveng.entities, reveng.pojos, copymetafiles, clean, compile, run, reveng.hbmxml, ]
reveng.entities:
[hibernatetool] Executing Hibernate Tool with a JPA Configuration
[hibernatetool] 1. task: hbm2hbmxml (Generates a set of hbm.xml files)
[hibernatetool] 47 [main] INFO org.hibernate.cfg.annotations.Version - Hibernate Annotations 3.4.0.GA
[hibernatetool] 62 [main] INFO org.hibernate.cfg.Environment - Hibernate 3.3.0.SP1
[hibernatetool] 62 [main] INFO org.hibernate.cfg.Environment - hibernate.properties not found
[hibernatetool] 78 [main] INFO org.hibernate.cfg.Environment - Bytecode provider name : javassist
[hibernatetool] 78 [main] INFO org.hibernate.cfg.Environment - using JDK 1.4 java.sql.Timestamp handling
[hibernatetool] 172 [main] INFO org.hibernate.annotations.common.Version - Hibernate Commons Annotations 3.1.0.GA
[hibernatetool] 172 [main] INFO org.hibernate.ejb.Version - Hibernate EntityManager 3.4.0.GA
[hibernatetool] 922 [main] INFO org.hibernate.cfg.AnnotationConfiguration - Hibernate Validator not found: ignoring
[hibernatetool] 2. task: hbm2cfgxml (Generates hibernate.cfg.xml)
[hibernatetool] 3. task: hbm2java (Generates a set of .java files)
BUILD SUCCESSFUL
Total time: 1 second