-->
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.  [ 1 post ] 
Author Message
 Post subject: Database Query using Hibernate
PostPosted: Tue Aug 02, 2011 12:49 am 
Newbie

Joined: Tue Aug 02, 2011 12:34 am
Posts: 1
Hi, we are working on a migration project. Currently we are using stored procedures for fetching the data which uses linked servers to fetch cross server data. Below is a query to give you some idea.
Code:
Select   C.CompanyName,
   WHName = case when PO.DelWhID = 0 then 'Multiple' else (select WarehouseName from             Server2.Configuration.dbo.Warehouse where WarehouseID = PO.DelWhID) end,
         IV.CreateDate,
         IV.ShipDate,
         PO.PONumber
From   Invoice   IV With (NoLock),
   PurchaseOrder PO With (NoLock),
   Server2.Configuration.dbo.Company   C
Where   IV.SellerUserID = @UserID
   and   PO.BuyerCompID = C.CompanyID
   and   PO.OrderID = IV.OrderID   
   and      (@SearchTextBy = 0
         or @SearchValue = ''
         or (@SearchTextBy = 1 and C.CompanyName like '%' + @SearchValue + '%')
         or (@SearchTextBy = 2 and PO.PONumber like '%' + @SearchValue + '%')
         or (@SearchTextBy = 3 and iv.InvoiceNumber like '%' + @SearchValue + '%') )   


Please suggest the best way to implement this using Hibernate. Thanks in advance for any suggestion.


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

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.