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.