-->
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.  [ 1 post ] 
Author Message
 Post subject: A bidirectional one-to-many association on a join table
PostPosted: Thu Jan 05, 2006 4:40 am 
Newbie

Joined: Thu Jan 05, 2006 1:37 am
Posts: 2
Component/s: hbm2java
Affects Version/s: 3.1beta2
Fix Version/s: None
parent.hbm.xml:
<hibernate-mapping
package="org.hibernate.test.onetomany">

<class name="Parent">
<id name="id" type="java.lang.Long" column="parent_id">
<generator class="hilo">
<param name="table">hi_value</param>
<param name="column">next_value</param>
<param name="max_lo">100</param>
</generator>
</id>
<property name="name" type="string" column="name"/>
<set name="children"
table="ParentChild"
cascade="all"
inverse="true">
<key column="parent_id"/>
<many-to-many column="child_id"
class="Child"/>
</set>

</class>


</hibernate-mapping>

child.hbm.xml

<hibernate-mapping
package="org.hibernate.test.onetomany">


<class name="Child">
<id name="id" type="java.lang.Long" column="parent_id">
<generator class="hilo">
<param name="table">hi_value</param>
<param name="column">next_value</param>
<param name="max_lo">100</param>
</generator>
</id>
<property name="name" type="string" column="name"/>
<join table="ParentChild"
optional="true">
<key column="child_id"/>
<many-to-one name="parent"
column="parent_id"
not-null="true"/>
</join>
</class>

when i execute ant hbm2java,the following messages are output.
hbm2java:
[hibernatetool] Executing Hibernate Tool with a Standard Configuration
[hibernatetool] 1. task: hbm2java (Generates a set of .java files)
[hibernatetool] 15:32:25,687 INFO Environment:479 - Hibernate 3.1
[hibernatetool] 15:32:25,734 INFO Environment:494 - loaded properties from resource hibernate.properties: {
hibernate.connection.driver_class=com.sybase.jdbc3.jdbc.SybDriver, hibernate.cglib.use_reflection_optimizer=
true, hibernate.cache.provider_class=org.hibernate.cache.HashtableCacheProvider, hibernate.max_fetch_depth=1
, hibernate.dialect=org.hibernate.dialect.SybaseDialect, hibernate.jdbc.use_streams_for_binary=true, hiberna
te.query.substitutions=true 1, false 0, yes 'Y', no 'N', hibernate.proxool.pool_alias=pool1, hibernate.conne
ction.username=sa, hibernate.cache.region_prefix=hibernate.test, hibernate.connection.url=jdbc:sybase:Tds:Ev
a:5003/DeviceManager, hibernate.connection.password=****, hibernate.jdbc.batch_versioned_data=true, hibernat
e.connection.pool_size=1}
[hibernatetool] 15:32:25,812 INFO Environment:524 - using java.io streams to persist binary types
[hibernatetool] 15:32:25,828 INFO Environment:525 - using CGLIB reflection optimizer
[hibernatetool] 15:32:25,843 INFO Environment:555 - using JDK 1.4 java.sql.Timestamp handling
[hibernatetool] 15:32:26,265 INFO Configuration:264 - Reading mappings from file: F:\testWeb\src\Child.hbm.
xml
[hibernatetool] 15:32:27,000 INFO HbmBinder:265 - Mapping class: org.hibernate.test.onetomany.Child -> Chil
d
[hibernatetool] 15:32:27,125 INFO HbmBinder:904 - Mapping class join: org.hibernate.test.onetomany.Child ->
ParentChild

BUILD FAILED
F:\testWeb\build.xml:101: Failed in building configuration when adding F:\testWeb\src\Child.hbm.xml



when i execute ant -verbose hbm2java,the following messages are output.
F:\testWeb\build.xml:101: Failed in building configuration when adding F:\testWeb\src\Child.hbm.xml
at org.hibernate.tool.ant.ConfigurationTask.addFile(ConfigurationTask.java:145)
at org.hibernate.tool.ant.ConfigurationTask.addMappings(ConfigurationTask.java:123)
at org.hibernate.tool.ant.ConfigurationTask.doConfiguration(ConfigurationTask.java:109)
at org.hibernate.tool.ant.ConfigurationTask.getConfiguration(ConfigurationTask.java:55)
at org.hibernate.tool.ant.HibernateToolTask.getConfiguration(HibernateToolTask.java:179)
at org.hibernate.tool.ant.HibernateToolTask.getProperties(HibernateToolTask.java:195)
at org.hibernate.tool.ant.ExporterTask.configureExporter(ExporterTask.java:90)
at org.hibernate.tool.ant.Hbm2JavaExporterTask.configureExporter(Hbm2JavaExporterTask.java:34)
at org.hibernate.tool.ant.ExporterTask.execute(ExporterTask.java:38)
at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:143)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
at org.apache.tools.ant.Task.perform(Task.java:364)
at org.apache.tools.ant.Target.execute(Target.java:341)
at org.apache.tools.ant.Target.performTasks(Target.java:369)
at org.apache.tools.ant.Project.executeTarget(Project.java:1214)
at org.apache.tools.ant.Project.executeTargets(Project.java:1062)
at org.apache.tools.ant.Main.runBuild(Main.java:673)
at org.apache.tools.ant.Main.startAnt(Main.java:188)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:196)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:55)
Caused by: org.hibernate.MappingException: Could not read mapping document from file: F:\testWeb\src\Child.h
bm.xml
at org.hibernate.cfg.Configuration.addFile(Configuration.java:269)
at org.hibernate.tool.ant.ConfigurationTask.addFile(ConfigurationTask.java:140)
... 19 more
Caused by: org.hibernate.MappingException: class org.hibernate.test.onetomany.Child not found while looking
for property: parent
at org.hibernate.util.ReflectHelper.reflectedPropertyClass(ReflectHelper.java:80)
at org.hibernate.mapping.ToOne.setTypeUsingReflection(ToOne.java:58)
at org.hibernate.cfg.HbmBinder.createProperty(HbmBinder.java:2065)
at org.hibernate.cfg.HbmBinder.bindJoin(HbmBinder.java:958)
at org.hibernate.cfg.HbmBinder.createClassProperties(HbmBinder.java:2006)
at org.hibernate.cfg.HbmBinder.createClassProperties(HbmBinder.java:1940)
at org.hibernate.cfg.HbmBinder.bindRootPersistentClassCommonValues(HbmBinder.java:324)
at org.hibernate.cfg.HbmBinder.bindRootClass(HbmBinder.java:238)
at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:109)
at org.hibernate.cfg.Configuration.add(Configuration.java:385)
at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:426)
at org.hibernate.cfg.Configuration.addFile(Configuration.java:266)
... 20 more
Caused by: java.lang.ClassNotFoundException: org.hibernate.test.onetomany.Child
at org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1149)
at org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:1090)
at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:960)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:141)
at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:108)
at org.hibernate.util.ReflectHelper.reflectedPropertyClass(ReflectHelper.java:76)
... 31 more
--- Nested Exception ---
org.hibernate.MappingException: Could not read mapping document from file: F:\testWeb\src\Child.hbm.xml
at org.hibernate.cfg.Configuration.addFile(Configuration.java:269)
at org.hibernate.tool.ant.ConfigurationTask.addFile(ConfigurationTask.java:140)
at org.hibernate.tool.ant.ConfigurationTask.addMappings(ConfigurationTask.java:123)
at org.hibernate.tool.ant.ConfigurationTask.doConfiguration(ConfigurationTask.java:109)
at org.hibernate.tool.ant.ConfigurationTask.getConfiguration(ConfigurationTask.java:55)
at org.hibernate.tool.ant.HibernateToolTask.getConfiguration(HibernateToolTask.java:179)
at org.hibernate.tool.ant.HibernateToolTask.getProperties(HibernateToolTask.java:195)
at org.hibernate.tool.ant.ExporterTask.configureExporter(ExporterTask.java:90)
at org.hibernate.tool.ant.Hbm2JavaExporterTask.configureExporter(Hbm2JavaExporterTask.java:34)
at org.hibernate.tool.ant.ExporterTask.execute(ExporterTask.java:38)
at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:143)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
at org.apache.tools.ant.Task.perform(Task.java:364)
at org.apache.tools.ant.Target.execute(Target.java:341)
at org.apache.tools.ant.Target.performTasks(Target.java:369)
at org.apache.tools.ant.Project.executeTarget(Project.java:1214)
at org.apache.tools.ant.Project.executeTargets(Project.java:1062)
at org.apache.tools.ant.Main.runBuild(Main.java:673)
at org.apache.tools.ant.Main.startAnt(Main.java:188)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:196)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:55)
Caused by: org.hibernate.MappingException: class org.hibernate.test.onetomany.Child not found while looking
for property: parent
at org.hibernate.util.ReflectHelper.reflectedPropertyClass(ReflectHelper.java:80)
at org.hibernate.mapping.ToOne.setTypeUsingReflection(ToOne.java:58)
at org.hibernate.cfg.HbmBinder.createProperty(HbmBinder.java:2065)
at org.hibernate.cfg.HbmBinder.bindJoin(HbmBinder.java:958)
at org.hibernate.cfg.HbmBinder.createClassProperties(HbmBinder.java:2006)
at org.hibernate.cfg.HbmBinder.createClassProperties(HbmBinder.java:1940)
at org.hibernate.cfg.HbmBinder.bindRootPersistentClassCommonValues(HbmBinder.java:324)
at org.hibernate.cfg.HbmBinder.bindRootClass(HbmBinder.java:238)
at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:109)
at org.hibernate.cfg.Configuration.add(Configuration.java:385)
at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:426)
at org.hibernate.cfg.Configuration.addFile(Configuration.java:266)
... 20 more
Caused by: java.lang.ClassNotFoundException: org.hibernate.test.onetomany.Child
at org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1149)
at org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:1090)
at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:960)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:141)
at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:108)
at org.hibernate.util.ReflectHelper.reflectedPropertyClass(ReflectHelper.java:76)
... 31 more


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

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.