-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: sql query to HQL
PostPosted: Thu Dec 15, 2005 1:06 pm 
Newbie

Joined: Thu Dec 15, 2005 1:02 pm
Posts: 1
can anyone change this query to hibernate query:

INSERT INTO dbo.tbl_correspondence(receiptdate, duedate, document, status)
SELECT bat.batch_receipt_date , bat.batch_receipt_date+30 , DE.Image, 'Active' FROM dbo.Tbl_DataEntry DE INNER JOIN
dbo.tbl_batches bat ON bat.batch_batch_number = DE.BatchId INNER JOIN dbo.tbl_DataEntryFormType typ ON typ.Id = bat.FormId
WHERE (typ.Id IN (3, 4, 5, 13, 14, 15, 16, 17))

thanks,
Bharath
pepala_bharath@yahoo.com


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 19, 2005 12:57 am 
Regular
Regular

Joined: Wed May 05, 2004 3:41 pm
Posts: 118
Location: New Jersey,USA
i think the "insert into..select" paradimgm goes against the concept of ORM tools where you manage entities and not jsut do insert updates.

Also you have to keep in mind that for Hibernate to be efficient it needs to perisit idependently. For e.g. first and second level caching will be possible only if Hibernate is called for persisting the entities. In your case there's no direct Hibernate friendly way of doing a batch insert. You could however iterate over the result set and do a .save() and fush() respectively.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 19, 2005 1:06 am 
Regular
Regular

Joined: Wed May 05, 2004 3:41 pm
Posts: 118
Location: New Jersey,USA
You might want to look at this posting too:

http://forum.hibernate.org/viewtopic.php?t=951350&highlight=


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.