-->
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: hibernate tools and annotation
PostPosted: Thu Sep 01, 2005 8:14 am 
Newbie

Joined: Thu Sep 01, 2005 7:43 am
Posts: 2
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:
Hibernate Annotations 3.1beta4
Hibernate Tools 3.1.0.alpha5
Hibernate 3.1.rc1

Mapping documents:
hibernate.cfg.xml:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
    "-//Hibernate/Hibernate Configuration DTD//EN"
    "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
  <session-factory>
    <property name="dialect">org.hibernate.dialect.Oracle9Dialect</property>
class="RoleEEJB3"/>-->
    <mapping jar="ims-ejb.ejb3"/>
  </session-factory>
</hibernate-configuration>


ant build.xml:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<project name="Radius3 build" default="generate" basedir="..">
  <classfileset dir="${basedir}/lib">
    <include name="*"/>
  </classfileset>

  <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask">
  </taskdef>

  <target name="init">
    <property name="dir.src" value="${basedir}/src"/>
    <property name="dir.metainf" value="${dir.src}/META-INF"/>
    <property name="dir.classes" value="${basedir}/classes"/>
    <property name="dir.misc" value="${basedir}/misc"/>

    <fileset dir="${basedir}/lib" id="libs">
      <include name="*"/>
    </fileset>
  </target>

  <target name="generate" depends="init">
    <hibernatetool destdir="${basedir}" >
      <classpath>
        <dirset dir="${dir.classes}"/>
      </classpath>

      <annotationconfiguration configurationfile="${dir.misc}/hibernate.cfg.xml"/>
      <hbm2ddl drop="false" outputfilename="ddl.sql" export="false"/>
    </hibernatetool>
  </target>
</project>


ddl.sql is empty after executing ant :-(

When I change
Code:
<mapping jar="ims-ejb.ejb3"/>

to
Code:
<mapping class="com.uralcom.ims.ejb3.ClientEEJB3" />

in hibernate.cfg.xml I get message:
Code:
BUILD FAILED
java.lang.NoSuchMethodError: org.hibernate.cfg.Mappings.<init>(Ljava/util/Map;Ljava/util/Map;Ljava/util/Map;Ljava/util/Map;Ljava/util/Map;Ljava/util/Map;Ljava/util/Map;Ljava/util/List;Ljava/util/List;Lorg/hibernate/cfg/NamingStrategy;Ljava/util/Map;Ljava/util/Map;Ljava/util/Map;)V


When I change hibernate version to
Hibernate tools 3.0.0.alpha4a
Hibernate Annotations 3.1beta3
Hibernate 3.1.beta2
second case of build.xml work fine, but in first case ddl.sql is empty.
Why? Can I use wildcard in <mapping> element of hibernate.cfg.xml
Can I not use hibernate.cfg.xml because all the necessary information is in the annotation?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 01, 2005 1:43 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
search the forum have been answered....basically annotations only work with the tools in the CVS version.

/max

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 02, 2005 1:37 am 
Newbie

Joined: Thu Sep 01, 2005 7:43 am
Posts: 2
I have downloaded Hibernate3,HibernateExt from CVS. After some manipulations I was be able to build it. Then hibernate3.jar and hibernate-annotations.jar and hibernate-tools.jar were put to ${projectroot}/lib directory.

After I test following case of hibernate.cfg.xml
1: <mapping jar="ims-ejb.ejb3"/>
2: <mapping class="com.uralcom.ims.ejb3.RoleEEJB3" />
3: <mapping package="com.uralcom.ims.ejb3"/>
4: no <mapping> element in hibernate.cfg.xml

and get result
1: ddl.sql is empty
2. work fine
3. ddl.sql is empty
4. ddl.sql is empty

How I may use mapping information from annotation?


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.