Hello,
I'm a hibernate newbie. I generate the hbm.xml files with middle gen. I have two table profile (profile_id_no as primary key) and education (has education_id_no as primary key and profile_id_no as foreign key) .
profile --> education is one to many mapping.
Now, I need to run a query to find education by profile_id_no. Since the education.hbm.xml file was generated by middlegen, profile_id_no is not shown in the property tag, I can't do 'select from education ... where profileIdNo = ..."
Could anyone show me another way of getting education back by profile_id_no? Thank you very much for your help.
Below is my mapping file.
<hibernate-mapping>
<class name="data.hibernate.web.Education" table="EDUCATION">
<meta attribute="class-description" inherit="false">
@hibernate.class
table="EDUCATION"
</meta>
<id
name="educationIdNo"
type="java.lang.Integer"
column="EDUCATION_ID_NO"
>
<meta attribute="field-description">
@hibernate.id
generator-class="assigned"
type="java.lang.Integer"
column="EDUCATION_ID_NO"
</meta>
<generator class="assigned" />
</id>
<property
name="createDt"
type="java.sql.Timestamp"
column="CREATE_DT"
not-null="true"
length="26"
>
<meta attribute="field-description">
@hibernate.property
column="CREATE_DT"
length="26"
not-null="true"
</meta>
</property>
<property
name="schoolName"
type="java.lang.String"
column="SCHOOL_NAME"
length="80"
>
<meta attribute="field-description">
@hibernate.property
column="SCHOOL_NAME"
length="80"
</meta>
</property>
<property
name="degree"
type="java.lang.String"
column="DEGREE"
length="80"
>
<meta attribute="field-description">
@hibernate.property
column="DEGREE"
length="80"
</meta>
</property>
<property
name="graduatedDt"
type="java.sql.Timestamp"
column="GRADUATED_DT"
length="26"
>
<meta attribute="field-description">
@hibernate.property
column="GRADUATED_DT"
length="26"
</meta>
</property>
<property
name="major"
type="java.lang.String"
column="MAJOR"
length="40"
>
<meta attribute="field-description">
@hibernate.property
column="MAJOR"
length="40"
</meta>
</property>
<!-- Associations -->
<!-- bi-directional many-to-one association to ProfileEntity -->
<many-to-one
name="profile"
class="data.hibernate.web.Profile"
not-null="true"
>
<meta attribute="field-description">
@hibernate.many-to-one
not-null="true"
@hibernate.column name="PROFILE_ID_NO"
@hibernate.column name="PROFILE_ID_NO"
</meta>
<column name="PROFILE_ID_NO" />
<column name="PROFILE_ID_NO" />
</many-to-one>
</class>
</hibernate-mapping>
|