Joined: Mon Feb 28, 2005 7:08 pm Posts: 4
|
Read the rules before posting!
http://www.hibernate.org/ForumMailingli ... AskForHelp
Using one mapping file works just fine, but splitting the subclasses into separate mapping files does not...
Hibernate version:3.0RC1
Mapping documents:<?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <hibernate-mapping package="example"> <class name="Person" table="person" discriminator-value="Person"> <id name="id" column="person_id" type="long" unsaved-value="null"> <generator class="hilo"/> </id> <discriminator column="subtype" type="string"/> <property name="name" column="name" type="string" length="30" not-null="true"/> <property name="age" column="age" type="float"/> <!--subclass name="Parent" discriminator-value="Parent"> <set name="children" inverse="false" cascade="all" lazy="true"> <key column="parent_id" /> <one-to-many class="Child"/> </set> </subclass--> <!--subclass name="Child" discriminator-value="Child"> <many-to-one name="parent" class="Parent" column="parent_id" not-null="false"/> </subclass--> </class> </hibernate-mapping> <?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <hibernate-mapping package="example"> <subclass name="Parent" extends="Person" discriminator-value="Parent"> <set name="children" inverse="false" cascade="all" lazy="true"> <key column="parent_id" /> <one-to-many class="Child"/> </set> </subclass> </hibernate-mapping> <?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <hibernate-mapping package="example"> <subclass name="Child" extends="Person" discriminator-value="Child"> <many-to-one name="parent" class="Parent" column="parent_id" not-null="false"/> </subclass > </hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
Full stack trace of any exception that occurs:
Name and version of the database you are using:
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt:Buildfile: C:\Documents and Settings\Peter2\workspace\HibernateTest3\build.xml schemaexport: [schemaexport] 00:00:07,656 INFO Environment:456 - Hibernate 3.0rc1 [schemaexport] 00:00:07,718 INFO Environment:474 - loaded properties from resource hibernate.properties: {hibernate.order_updates=true, hibernate.default_batch_fetch_size=8, hibernate.connection.driver_class=org.postgresql.Driver, hibernate.cglib.use_reflection_optimizer=true, hibernate.cache.provider_class=org.hibernate.cache.HashtableCacheProvider, hibernate.max_fetch_depth=1, hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect, hibernate.jdbc.use_streams_for_binary=true, hibernate.query.substitutions=yes 'Y', no 'N', hibernate.proxool.pool_alias=pool1, hibernate.connection.username=peter, hibernate.cache.region_prefix=hibernate.test, hibernate.connection.url=jdbc:postgresql://localhost/hibernatetest3, hibernate.show_sql=true, hibernate.connection.password=****, hibernate.jdbc.batch_versioned_data=true, hibernate.connection.pool_size=1} [schemaexport] 00:00:07,718 INFO Environment:501 - using java.io streams to persist binary types [schemaexport] 00:00:07,734 INFO Environment:502 - using CGLIB reflection optimizer [schemaexport] 00:00:07,734 INFO Environment:532 - using JDK 1.4 java.sql.Timestamp handling [schemaexport] 00:00:07,765 INFO Configuration:219 - Mapping file: C:\Documents and Settings\Peter2\workspace\HibernateTest3\src\example\child.hbm.xml [schemaexport] 00:00:08,250 INFO Configuration:219 - Mapping file: C:\Documents and Settings\Peter2\workspace\HibernateTest3\src\example\parent.hbm.xml [schemaexport] 00:00:08,343 INFO Configuration:219 - Mapping file: C:\Documents and Settings\Peter2\workspace\HibernateTest3\src\example\person.hbm.xml [schemaexport] 00:00:08,421 INFO HbmBinder:256 - Mapping class: example.Person -> person [schemaexport] 00:00:08,671 INFO Dialect:89 - Using dialect: org.hibernate.dialect.PostgreSQLDialect [schemaexport] 00:00:08,890 INFO Configuration:844 - processing extends queue [schemaexport] 00:00:09,046 INFO HbmBinder:733 - Mapping subclass: example.Parent -> person [schemaexport] 00:00:09,062 INFO Configuration:848 - processing collection mappings
BUILD FAILED C:\Documents and Settings\Peter2\workspace\HibernateTest3\build.xml:50: Schema text failed: Association references unmapped class: example.Child
Total time: 9 seconds
|
|