-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: hbm2hbmxml JPAconfiguration exception
PostPosted: Thu Feb 22, 2007 6:48 am 
Beginner
Beginner

Joined: Thu Feb 22, 2007 6:08 am
Posts: 35
Hi there!

Im experiencing problems using the Hibernate tools (the ant tool). With the help nbXDoclet of Netbeans IDE 5.5, I have created a HibernateBean(EJB3) and a Persistence-Unit. (Im using the JPA mapping configurations) The bean it seams to be well annotated. The persistence.xml file was created on the "./src/conf/" dir and after build it is placed on the "./build/web/WEB-INF/classes/META-INF/".

Next step was create a ant file to create the .hbm.xml mapping files. Everything went fine till here. I got an exception from the ant.

down there i leave the ant hbm2hbmxml.xml and persistence.xml file

Hibernate version:
Hibernate Core 3.2.2 GA
Hibernate EntityManager 3.2.1 GA
Hibernate Tools 3.2 beta 9

Mapping documents:
persistence.xml:
<?xml version="1.0" encoding="UTF-8" ?>
<persistence version="1.0" 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/ ... ce_1_0.xsd">
<persistence-unit name="ImmoServerUnit" transaction-type="RESOURCE_LOCAL">
<provider>oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider</provider>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="toplink.jdbc.url" value="jdbc:mysql://localhost:3306/immo" />
<property name="toplink.jdbc.user" value="root" />
<property name="toplink.jdbc.driver" value="com.mysql.jdbc.Driver" />
<property name="toplink.jdbc.password" value="" />
<property name="hibernate.hbm2ddl.auto" value="create-drop" />
<property name="toplink.ddl-generation" value="drop-and-create-tables" />
</properties>
</persistence-unit>
</persistence>

Ant tool file:
<?xml version="1.0" encoding="UTF-8" ?>
<project name="hbm2hbmxml" default="all" basedir=".">
<target name="hbm2hbmxml" description="Generate .hbm.xml from .java files.">
<property name="build.dir" value="./build/web/WEB-INF/classes" />
<property name="config.dir" value="./src/conf" />
<path id="toolslib">
<path location="lib/hibernate-core/hibernate3.jar" />
<path location="lib/hibernate-core/commons-logging-1.0.4.jar" />
<path location="lib/hibernate-core/dom4j-1.6.1.jar" />
<path location="lib/hibernate-entitymanager/hibernate-annotations.jar" />
<path location="lib/hibernate-entitymanager/ejb3-persistence.jar" />
<path location="lib/hibernate-entitymanager/hibernate-entitymanager.jar" />
<path location="lib/hibernate-entitymanager/javassist.jar" />
<path location="lib/hibernate-entitymanager/jboss-archive-browsing.jar" />
<path location="lib/hibernate-tools/hibernate-tools.jar" />
<path location="lib/hibernate-tools/freemarker.jar" />
<path location="lib/mysql-connector-java-3.1.8-bin.jar" />
</path>
<taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="toolslib" />
<hibernatetool destdir="${build.dir}/immoserver/persistence">
<jpaconfiguration persistenceunit="ImmoServerUnit" />
<classpath>
<path location="${build.dir}" />
</classpath>
<hbm2hbmxml />
</hibernatetool>
</target>
</project>

Full stack trace of ant exception:
hbm2hbmxml:
Executing Hibernate Tool with a JPA Configuration
1. task: hbm2hbmxml (Generates a set of hbm.xml files)
22/Fev/2007 9:04:17 org.hibernate.ejb.Version <clinit>
INFO: Hibernate EntityManager 3.2.1.GA
22/Fev/2007 9:04:17 org.hibernate.cfg.annotations.Version <clinit>
INFO: Hibernate Annotations 3.2.1.GA
22/Fev/2007 9:04:17 org.hibernate.cfg.Environment <clinit>
INFO: Hibernate 3.2.2
22/Fev/2007 9:04:17 org.hibernate.cfg.Environment <clinit>
INFO: hibernate.properties not found
22/Fev/2007 9:04:17 org.hibernate.cfg.Environment buildBytecodeProvider
INFO: Bytecode provider name : cglib
22/Fev/2007 9:04:17 org.hibernate.cfg.Environment <clinit>
INFO: using JDK 1.4 java.sql.Timestamp handling
An exception occurred while running exporter #2:hbm2hbmxml (Generates a set of hbm.xml files)
To get the full stack trace run ant with -verbose
Persistence unit not found: 'ImmoServerUnit'.
C:\Documents and Settings\Marco\Os meus documentos\Programming\ImoOnline\ImmoWS\hbm2hbmxml.xml:25: Persistence unit not found: 'ImmoServerUnit'.
BUILD FAILED (total time: 0 seconds)

If any one could help me, i would appreciate
thans a lot

--ms


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 22, 2007 7:05 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
the problem is that you don't have a proper JPA packaged archive in the classpath....but maybe just as important...it sounds like you think JPA Annotations are used in the same way as Xdoclet and hence need an extra buildstep of generating hbm.xml - that is not true! JPA Annotations are read directly and hence hbm2hbmxml is just there for migration back and forth.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 27, 2007 5:25 am 
Beginner
Beginner

Joined: Thu Feb 22, 2007 6:08 am
Posts: 35
Thanx a lot max. I was really thinking like that. The annotations eliminate the needs to have the hbm files. Reading the all chapter 2 of the Book "Java Persistence with Hibernate".


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.