HI
Using Hibernate 3.0.5.
I am trying to figure out if this is a problem or if this is done by design.
For the Many-to-one, after executing a query, the many-to-one app_id attribute in AppfObjectVO is NULL.
My question, is this by design, or is there a way to get hibernate to populate that attribute when it's defined as a many to one.
Mapping:
Code:
<?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 default-lazy="true" package="com.cetelex.pwrsecure.dao.vo">
<class name="AppfObjectVO" table="appf_object">
<id name="ao_id" type="long" unsaved-value="null">
<generator class="sequence">
<param name="sequence">pwrs_seq</param>
</generator>
</id>
<timestamp name="last_chg_dtm"/>
<many-to-one name="app_code" class="AppVO" column="app_id" not-null="true" lazy="false"/>
<many-to-one name="appf_type_code" class="AppfTypeCodeVO" column="ao_atc_id" not-null="true" lazy="false" />
<property name="ao_class" type="string" not-null="false" length="255"/>
<property name="last_chg_uid" type="string" length="15" not-null="true"/>
<set name="racc" inverse="true" lazy="true">
<key column="ao_id"/>
<one-to-many class="RaccVO"/>
</set>
</class>
</hibernate-mapping>
Class:
Code:
public class AppfObjectVO
{
private Long m_ao_id;
private Long m_app_id;
private String m_ao_class;
private Long m_ao_atc_id;
private Date m_last_chg_dtm;
private String m_last_chg_uid;
public Long getAo_id() {return(m_ao_id);}
public Long getApp_id() {return(m_app_id);}
public String getAo_class() {return(m_ao_class);}
public Long getAo_atc_id() {return(m_ao_atc_id);}
public Date getLast_chg_dtm() {return(m_last_chg_dtm);}
public String getLast_chg_uid() {return(m_last_chg_uid);}
public void setAo_id(Long value) {m_ao_id = value;}
public void setApp_id(Long value) {m_app_id = value;}
public void setAo_class(String value) {m_ao_class = value;}
public void setAo_atc_id(Long value) {m_ao_atc_id = value;}
public void setLast_chg_dtm(Date value) {m_last_chg_dtm = value;}
public void setLast_chg_uid(String value) {m_last_chg_uid = value;}
private Set<RaccVO> m_racc;
public Set<RaccVO> getRacc() {return(m_racc);}
public void setRacc(Set<RaccVO> v) {m_racc = v;}
private AppfTypeCodeVO m_appf_type_code;
public AppfTypeCodeVO getAppf_type_code() {return(m_appf_type_code);}
public void setAppf_type_code(AppfTypeCodeVO v) {m_appf_type_code = v;}
private AppVO m_app_code;
public AppVO getApp_code() {return(m_app_code);}
public void setApp_code(AppVO v) {m_app_code = v;}
public AppfObjectVO() {}
}
SQL:
Code:
String sql = "FROM AppfObjectVO";
SQL Generated by Hibernate:
Code:
select appfobject0_.ao_id as ao1_,
appfobject0_.last_chg_dtm as last2_7_,
appfobject0_.app_id as app3_7_,
appfobject0_.ao_atc_id as ao4_7_,
appfobject0_.ao_class as ao5_7_,
appfobject0_.last_chg_uid as last6_7_
from appf_object appfobject0_