max wrote:
[code]
Adding the same mapping file twice will obviously give you parsing errors since you will have naming collisions.
check your cfg.xml and filesets in the ant config to see if you are actually specfiying the hbm.xml multiple times.
Hi Max!
yes, I see that it is added twice, but I don't understand why? I haven't changes anything in this part since my other project where I used Hibernate tools 3.2 beta 7.
Anyway, this is how my config looks like:
[code]
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.bytecode.use_reflection_optimizer">false</property>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<!-- This connection URL is for the development database -->
<property name="hibernate.connection.url">jdbc:mysql://localhost:3306/webshop</property>
<property name="hibernate.connection.username">username</property>
<property name="hibernate.connection.password">password</property>
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="hibernate.show_sql">true</property>
<mapping file="C:/DevArea2/projects/webshop/hibernate/namedqueries/namedQueries-appuser.hbm.xml"/>
<mapping file="C:/DevArea2/projects/webshop/hibernate/namedqueries/namedQueries-appuserrole.hbm.xml"/>
<mapping file="C:/DevArea2/projects/webshop/hibernate/namedqueries/namedQueries-communicationboard.hbm.xml"/>
<mapping file="C:/DevArea2/projects/webshop/hibernate/namedqueries/namedQueries-communicationboardfile.hbm.xml"/>
<mapping file="C:/DevArea2/projects/webshop/hibernate/namedqueries/namedQueries-customer.hbm.xml"/>
<mapping file="C:/DevArea2/projects/webshop/hibernate/namedqueries/namedQueries-customeraddress.hbm.xml"/>
<mapping file="C:/DevArea2/projects/webshop/hibernate/namedqueries/namedQueries-customeremail.hbm.xml"/>
<mapping file="C:/DevArea2/projects/webshop/hibernate/namedqueries/namedQueries-customerphone.hbm.xml"/>
<mapping file="C:/DevArea2/projects/webshop/hibernate/namedqueries/namedQueries-employee.hbm.xml"/>
<mapping file="C:/DevArea2/projects/webshop/hibernate/namedqueries/namedQueries-employeeaddress.hbm.xml"/>
<mapping file="C:/DevArea2/projects/webshop/hibernate/namedqueries/namedQueries-employeeemail.hbm.xml"/>
<mapping file="C:/DevArea2/projects/webshop/hibernate/namedqueries/namedQueries-employeephone.hbm.xml"/>
<mapping file="C:/DevArea2/projects/webshop/hibernate/namedqueries/namedQueries-loginevent.hbm.xml"/>
<mapping file="C:/DevArea2/projects/webshop/hibernate/namedqueries/namedQueries-userrole.hbm.xml"/>
<mapping file="C:/DevArea2/projects/webshop/hibernate/namedqueries/namedQueries-website.hbm.xml"/>
</session-factory>
</hibernate-configuration>
[/code]
and my ant script:
[code]
<target name="generateHibernateDaoImplClasses">
<hibernatetool>
<configuration
configurationfile="${hibernateRootDir}/hibernate.cfg.xml">
<fileset dir="${hibernateRootDir}">
<include name="/namedqueries/*.hbm.xml"/>
</fileset>
<fileset dir="${hibernateMappingFileLocation}">
<include name="*.hbm.xml"/>
</fileset>
</configuration>
<hbmtemplate
filepattern="{class-name}DaoImpl.java"
templatepath="${hibernateRootDir}/template/dao"
template="daoimpl.ftl"
destdir="${hibernateDaoLocation}">
<property key="jdk5" value="true"/>
<property key="ejb3" value="false"/>
</hbmtemplate>
</hibernatetool>
</target>
[/code]
I tried to take out either the namedqueries files in the cfg.xml or in the ant script but then it generates the classes, but with no namedqueries additions...
I can't see why Hibernate tools pulls in the last file again... and why it only pulls in that one. I also verified that I don't have any additional mapping files added through the UI under the tab Mappings.
I am stuck with this one and really thankful for any help,
Jacob