ok, thx...but now lets go further..:
From the above Classes XDoclet generates me this MappingFile:
Code:
<?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="package.path.table"
table="table_in_database"
schema="tables_schema">
<composite-id
name="t_pk"
class="package.path.table_pk">
<key-property
name="ker"
type="long"
column="column1_in_table"
length="4"/>
<key-many-to-one
name="land"
class="package.path.ClassOfReferencedTable"
column="column2_in_table"/>
</composite-id>
</class>
</hibernate-mapping>
now i try to get acces over follwing mapped Class:
Code:
class table_2 {
public long column1;
public table column2;
[color=blue]/**
*@hibernate.id
* column="column1_in_table2"
* generator-class="assigned"
*/ [/color]
public long getColumn1(){return column1;}
[color=blue]/**
* @hibernate.many-to-one
* column = "column2_in_table2"
* not-null = "true"
* property-ref="column1_in_table"//should i use this?
* class="<code>table</code>";
*/[/color]public String getColumn2(){return column2;}
[color=blue]/**
* @hibernate.many-to-one
* column = "column3_in_table2"
* not-null = "true"
* class="<code>anothertable</code>";
*/[/color]
public String getColumn2(){return column2;}
public void setColumn1(long column1){this.column1=column1;}
public void setColumn2(table column2){this.column2=column2;}
public void setColumn2(anothertable column3){this.column2=column3;}
public String toString(){
//get all fields and concat them to one String;
}
}
now, executing this:
Code:
table2 t2=(table2)Session.get(table2.class);
System.out.println(t2);
throws following:
Code:
net.sf.hibernate.MappingException:
Foreign key (table2[column1_in_table2]))
must have same number of columns as the referenced primary key (table [column1,column2])
you still can follow me...?
by using update="false" and insert="false" in the XDoclet-tag of the second Method ,Hibernate says that that (update + insert) are not
supported buy that component....
still any idea my friend, thx....im near going crying....