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?