Hello everyone!
I am farely new to Hibernate and just have read and implemented a couple of examples from the books I have read.
However I am not being able to find a way to convert the following nested
sql (which I am using for a jdbc resultset) into an equivalent in hibernate . Could you please suggest a way (or reading) to get this done! I am looking for a class structure+hibernate mapping and the ultimate query that will retrieve the same set of results in effect from the database.
Thanks in advance, By the way I am using Hibernate 3 with Tomcat 6
Table structure is somewhat like the following
PUB_CODE STATUS_FLAG USER_ID ENTRY_DATE PUB_DATE
ENY RE jhuma 06/11/2008 06/11/2008
DCH RE jhuma 06/11/2008 06/11/2008
ENY AU jhuma 06/11/2008 08/10/2008
NESTED query for jdbc resultset
select pub_code,entry_date received,
(select entry_date from mis_outtrack where pub_code=mo.pub_code and status_flag='AU' and pub_date=mo.pub_date) audited,
(select entry_date from mis_outtrack where pub_code=mo.pub_code and status_flag='SE' and pub_date=mo.pub_date) sent,
pub_date
from mis_outtrack mo
where status_flag='RE' and PUB_DATE between '10-jan-2008' and '15-dec-2008' order by PUB_DATE
Expected Data format is ::->
PUB_CODE RECEIVED AUDITED SENT PUB_DATE
DTK 10/11/2008 10/11/2008 10/11/2008 14/09/2008
DTK 10/11/2008 10/11/2008 10/11/2008 15/09/2008
DTK 10/11/2008 10/11/2008 10/11/2008 16/09/2008
MKT 10/11/2008 10/11/2008 10/11/2008 07/10/2008
DTK 10/11/2008 10/11/2008 10/11/2008 08/10/2008
MKT 10/11/2008 10/11/2008 10/11/2008 23/10/2008
|