Hi People, Sorry by my bad english..
I have a problem with de one-to-many mapping. Take a look:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class
name="DataAttrib"
table="DATAATTRIB"
dynamic-update="false"
dynamic-insert="false"
>
<composite-id>
<key-property type="java.lang.String" name="cdData" column="CDDATA" l ength="18" />
<key-property type="java.lang.Long" name="cdAttrib" column="CDSECTIONATTRIB" />
</composite-id>
<property
name="nmString"
type="java.lang.String"
update="true"
insert="true"
access="property"
column="NMSTRING"
/>
<property
name="vlFloat"
type="java.lang.Float"
update="true"
insert="true"
access="property"
column="VLFLOAT"
/>
<property
name="dtDate"
type="java.util.Date"
update="true"
insert="true"
access="property"
column="DTDATE"
/>
<property
name="dsMemo"
type="text"
update="true"
insert="true"
access="property"
column="DSMEMO"
/>
<set
name="myDataAttribValue"
table="FRDATAATTRIBVALUE"
lazy="false"
inverse="true"
cascade="none"
sort="unsorted"
>
<key>
<column name="CDFORMDATA" />
<column name="CDNATTRIB"/>
<column name="CDVALUE"/>
</key>
<one-to-many
class="FRDataAttribValue"
/>
</set>
<!--
To add non XDoclet property mappings, create a file named
hibernate-properties-FRFormDataAttribute.xml
containing the additional properties and place it in your merge dir.
-->
</class>
</hibernate-mapping>
I have a problem in this mapping because the composite keys in the one-to-many mapping. When i execute my server jBoss, I receive the message error:
net.sf.hibernate.MappingException: collection foreign key mapping has wrong number of columns: DataAttrib.myDataAttribValue type: DataAttrib
somebody can help me ??
Thanks ...
Jeferson...
Read the rules before posting!
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:
Mapping documents:
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: