Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Databases / July 2004

Tip: Looking for answers? Try searching our database.

[Hibernate] SQL Query

Thread view: 
Lionel - 07 May 2004 16:31 GMT
Hi all

I would like to do the following oracle sql query with hibernate by using
session.createSQLQuery but I don't know how...

SELECT fabId, produitId, SUM(total) AS total FROM
(
   SELECT p.fab_id AS fabId, p.produit_id AS produitId,
SUM(p.penalite_Valeur) AS total
   FROM PFT_PENALITE p
   GROUP BY p.fab_id, p.produit_id

   UNION

   SELECT f.fab_id AS fabId, f.produit_id AS produitId,
SUM(f.fiche_Penalite)
   FROM PFT_FICHE f
   WHERE f.fiche_penalite >0
   GROUP BY f.fab_id, f.produit_id
)
GROUP BY fabId, produitId

Is it possible to do that ?
what to do with the alias parameter ?

thanks a lot for your help...

BTW: if someone sees another simplier way to do a union on 2 queries
followed by a group by, the solution is welcome....
kargam - 26 Jul 2004 11:38 GMT
Hi all,

i am new to hibernate
can we implement UNION operation in hibernate
if yes can u please give me an example
thank u in advance


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.