Hello Neil

I think the problem is it doesn't find the persistence.xml because it isn't
the standard META-INF/persistence.xml as per the hibernatools documentation:
https://www.hibernate.org/hib_docs/tools/reference/en/html/ant.html

"<jpaconfiguration> will simply just try and auto-configure itself based on
the available classpath, e.g. look for META-INF/persistence.xml."

Try moving your persistence.xml to the META-INF directory and try it again

Regards

Johann Reyes

-----Original Message-----
From: Neil Chaudhuri [mailto:nchaudh...@potomacfusion.com] 
Sent: Thursday, August 13, 2009 2:26 PM
To: users@maven.apache.org
Subject: Hibernate 3 Plugin

I am using Maven with JPA/Hibernate, and I would like to generate a DDL file
to give to my DBAs.  I am using the Hibernate 3 Maven plugin to do this.
However, I keep getting the error "[ERROR] Persistence unit not found:
'myapp'."

Here is the relevant portion of the POM:

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>hibernate3-maven-plugin</artifactId>
                <version>2.2</version>
                <configuration>
                    <components>
                        <component>
                            <name>hbm2ddl</name>
 
<implementation>jpaconfiguration</implementation>
                        </component>
                    </components>
                    <componentProperties>
                        <create>true</create>
                        <drop>false</drop>
                        <export>false</export>
 
<configurationfile>/target/classes/persistence.xml</configurationfile>
                        <persistenceunit>myapp</persistenceunit>
                        <outputfilename>myapp.sql</outputfilename>
                        <format>true</format>
                    </componentProperties>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>com.oracle.jdbc</groupId>
                        <artifactId>ojdbc6</artifactId>
                        <version>11.1.0.7.0</version>
                    </dependency>
                </dependencies>
            </plugin>

Here is the persistence.xml founf in src/main/resources as well as
target/classes:

     <persistence-unit name="myapp" transaction-type="RESOURCE_LOCAL">
        <provider>org.hibernate.ejb.HibernatePersistence</provider>
        <jta-data-source>MYAPP_DS</jta-data-source>
        <properties>
            <property name="hibernate.show_sql" value="true"/>
            <property name="hibernate.format_sql" value="true"/>
            <property name="hibernate.dialect"
value="org.hibernate.dialect.Oracle10gDialect"/>
            <property name="hibernate.cache.provider_class"
value="org.hibernate.cache.HashtableCacheProvider"/>
        </properties>
    </persistence-unit>


The files are where they are supposed to be, and surely the plugin knows to
look in the target folder for everything.  I would appreciate any insight
into what the issue might be.

Thanks.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org

Reply via email to