• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

hbm file mappings to access other tables from named queries

 
Sireesh Ganagam
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All ,

Below hbm file is mapped to Person table , i have a below named query to access Event object but it is failing , inorder to access Event entity object in Person hbm file how can i do that. i want to do only in hbm file , there is no relation between event and person , your inputs are highly appreciated.



<query name="getDeleted"><![CDATA[
from Event evntSmryHdr where evntSmryHdr.schedStartDate >= :minCI and evntSmryHdr.schedStartDate <= :maxCI
and evntSmryHdr.loginUserId =:loginUserId and evntSmryHdr.whse =:whse and evntSmryHdr.laborTypeId = 5 and evntSmryHdr.source = 'MS' and evntSmryHdr.lastModBy = 'MS' order by evntSmryHdr.schedStartDate
]]></query>




<?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 package="com.test.app.tap">
<class name="Person" table="E_INTERM_TA_STG">
<cache usage="nonstrict-read-write"/>
<property name="createDateTime" type="timestamp">
<column name="CREATE_DATE_TIME" length="23" />
</property>
<property name="modDateTime" type="timestamp">
<column name="MOD_DATE_TIME" length="23" />
</property>
<property name="userId" type="string">
<column name="USER_ID" />
</property>
</class>
<query name="getDeleted"><![CDATA[
from Event evntSmryHdr where evntSmryHdr.schedStartDate >= :minCI and evntSmryHdr.schedStartDate <= :maxCI
and evntSmryHdr.loginUserId =:loginUserId and evntSmryHdr.whse =:whse and evntSmryHdr.laborTypeId = 5 and evntSmryHdr.source = 'MS' and evntSmryHdr.lastModBy = 'MS' order by evntSmryHdr.schedStartDate
]]></query>


<query name="getBreakEnd"><![CDATA[
from Person stg
where stg.userId = :loginUserId
]]></query>

</hibernate-mapping>
 
Sireesh Ganagam
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sireesh Ganagam wrote:Hello All ,

Below hbm file is mapped to Person table , i have a below named query to access Event object but it is failing , inorder to access Event entity object in Person hbm file how can i do that. i want to do only in hbm file , there is no relation between event and person , your inputs are highly appreciated.



<query name="getDeleted"><![CDATA[
from Event evntSmryHdr where evntSmryHdr.schedStartDate >= :minCI and evntSmryHdr.schedStartDate <= :maxCI
and evntSmryHdr.loginUserId =:loginUserId and evntSmryHdr.whse =:whse and evntSmryHdr.laborTypeId = 5 and evntSmryHdr.source = 'MS' and evntSmryHdr.lastModBy = 'MS' order by evntSmryHdr.schedStartDate
]]></query>




<?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 package="com.test.app.tap">
<class name="Person" table="E_INTERM_TA_STG">
<cache usage="nonstrict-read-write"/>
<property name="createDateTime" type="timestamp">
<column name="CREATE_DATE_TIME" length="23" />
</property>
<property name="modDateTime" type="timestamp">
<column name="MOD_DATE_TIME" length="23" />
</property>
<property name="userId" type="string">
<column name="USER_ID" />
</property>
</class>
<query name="getDeleted"><![CDATA[
from Event evntSmryHdr where evntSmryHdr.schedStartDate >= :minCI and evntSmryHdr.schedStartDate <= :maxCI
and evntSmryHdr.loginUserId =:loginUserId and evntSmryHdr.whse =:whse and evntSmryHdr.laborTypeId = 5 and evntSmryHdr.source = 'MS' and evntSmryHdr.lastModBy = 'MS' order by evntSmryHdr.schedStartDate
]]></query>


<query name="getBreakEnd"><![CDATA[
from Person stg
where stg.userId = :loginUserId
]]></query>

</hibernate-mapping>
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic