Hi All,
Maps:
Code:
<class name="com.db.device.NEMgmtInfo" table="nemgmtinfo" mutable="true" polymorphism="implicit" dynamic-update="false" dynamic-insert="false">
<!--cache usage="read-write" /-->
<id name="id" type="long" unsaved-value="0">
<generator class="native">
</generator>
</id>
<many-to-one name="sflowAgent" class="com.db.device.SflowAgent" cascade="all"/>
</class>
<class name="com.db.device.FlowMonAgent" table="FlowMonAgent" mutable="true" polymorphism="implicit" dynamic-update="false" dynamic-insert="false">
<id name="id" type="long" unsaved-value="0">
<generator class="native" />
</id>
<property name="ipAddress" type="com.db.device.IPV4AddressType">
<column name="address_"/>
<column name="mask_"/>
</property>
<property name="opState" type="com.db.device.OperationalStatus"/>
<property name="adminState" type="com.db.device.AdminStatus"/>
<property name="ipPort" column="ip_port" type="integer"/>
<many-to-one name="pollingInterval" class="com.db.qos.valuewithunits.TimeInterval" cascade="all"/>
<many-to-one name="samplingInterval" class="com.db.qos.valuewithunits.TimeInterval" cascade="all"/>
<property name="useMgmtIPAddressAsFlow" type="boolean"/>
<joined-subclass name="com.db.device.SflowAgent" table="SflowAgent">
<key column="id"/>
</joined-subclass>
<joined-subclass name="com.db.device.NetFlowAgent" table="NetflowAgent">
<key column="id"/>
</joined-subclass>
</class>
and trying to execute:
Code:
q = sess.getPersistentSession().createQuery(
"select new com.db.device.NEMgmtInfoLightweight( "+
"nemgmtinfo.sflowAgent" +
") "+
"from com.db.device.NEMgmtInfo as nemgmtinfo");
where
Code:
public class NEMgmtInfoLightweight extends NEMgmtInfo implements Serializable {
public NEMgmtInfoLightweight() {
}
public NEMgmtInfoLightweight(
SflowAgent sflowAgent
) {
super.setSflowAgent((SflowAgent)sflowAgent);
}
}
Surprinsingly, the generated query does
not return anything from the DB (there are records in there) and NO ERROR is produced:
Hibernate:
Code:
select sflowagent1_.id as id,
sflowagent1__1_.address_ as address_33_,
sflowagent1__1_.mask_ as mask_33_,
sflowagent1__1_.opState as opState33_,
sflowagent1__1_.adminState as adminState33_,
sflowagent1__1_.ip_port as ip_port33_,
sflowagent1__1_.pollingInterval as pollingI7_33_,
sflowagent1__1_.samplingInterval as sampling8_33_,
sflowagent1__1_.useMgmtIPAddressAsFlow as useMgmtI9_33_
from nemgmtinfo nemgmtinfo0_,
SflowAgent sflowagent1_
left outer join FlowMonAgent sflowagent1__1_ on
sflowagent1_.id=sflowagent1__1_.id where nemgmtinfo0_.sflowAgent=sflowagent1_.id
What's wrong here?
Please Help.