Read the rules before posting!
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:2.1.8
Mapping documents:
<hibernate-mapping package="com.fujisawa.webforms.app">
<class
name="ProtocolFormsEdc2"
table="protocol_forms_edc2"
>
<composite-id name="Id" class="ProtocolFormsEdc2PK">
<key-property
name="InternalProtocolId"
column="internal_protocol_id"
type="integer"
/>
<key-property
name="Formno"
column="formno"
type="java.lang.Short"
/>
</composite-id>
<set name="crfRows" inverse="true" cascade="all-delete-orphan"
order-by="seqno asc">
<key column="formno"/>
<one-to-many class="DataDictionaryEdc2"/>
</set>
</class>
</hibernate-mapping>
<hibernate-mapping package="com.fujisawa.webforms.app">
<class
name="DataDictionaryEdc2"
table="data_dictionary_edc2"
>
<composite-id name="Id" class="DataDictionaryEdc2PK">
<key-property
name="InternalProtocolId"
column="internal_protocol_id"
type="integer"
/>
<key-property
name="ViewFieldName"
column="view_field_name"
type="string"
/>
<key-property
name="ViewName"
column="view_name"
type="string"
/>
</composite-id>
<many-to-one name="parent" not-null="true"
class="ProtocolFormsEdc2" insert="false"
update="false">
<column name="internal_protocol_id"/>
<column name="formno"/>
</many-to-one>
<property
name="Formno"
column="formno"
type="java.lang.Short"
not-null="false"
length="5"
/>
</class>
</hibernate-mapping>
[b]Code between sessionFactory.openSession() and session.close():
Full stack trace of any exception that occurs:
net.sf.hibernate.MappingException: collection foreign key mapping has wrong number of columns: com.fujisawa.webforms.app.ProtocolFormsEdc2.crfRows type: com.fujisawa.webforms.app.ProtocolFormsEdc2PK
at net.sf.hibernate.mapping.Collection.validate(Collection.java:248)
at net.sf.hibernate.cfg.Configuration.validate(Configuration.java:635)
at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:799)
at com.fujisawa.webforms.app.base._BaseRootDAO.initialize(_BaseRootDAO.java:55)
at com.fujisawa.webforms.app.base._BaseRootDAO.initialize(_BaseRootDAO.java:42)
at com.fujisawa.webforms.app.base._BaseRootDAO.initialize(_BaseRootDAO.java:33)
at com.fujisawa.webforms.app.dao.ProtocolFormsEdc2DAO.main(ProtocolFormsEdc2DAO.java:53):[/b]
Name and version of the database you are using:syabse ase 12.0.0.2
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt:2005-04-27 21:39:08,951 DEBUG: Second pass for collection: com.fujisawa.webforms.app.ProtocolFormsEdc2.crfRows
2005-04-27 21:39:08,951 INFO : Mapping collection: com.fujisawa.webforms.app.ProtocolFormsEdc2.crfRows -> data_dictionary_edc2
2005-04-27 21:39:08,951 DEBUG: Mapped collection key: formno, one-to-many: com.fujisawa.webforms.app.DataDictionaryEdc2
Hi There,
I've run out of examples to try. I'm stuck using composite-id's and I have problems with them routinely. Here's one that I've spent a few hours on without getting anywhere. It took a while before I found in the documentation that I could map multiple columns inside the one-to-many, and I really thought I found the solution. But no; and the number of columns in the mapping certainly seems to match to me.
Any help is hugely appreciated.
-scott