File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Object Relational Mapping and the fly likes Native SQL Query to Hibernate Query using Criteria Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Native SQL Query to Hibernate Query using Criteria" Watch "Native SQL Query to Hibernate Query using Criteria" New topic
Author

Native SQL Query to Hibernate Query using Criteria

Neel Mohan
Greenhorn

Joined: Apr 12, 2014
Posts: 1
Hi,

I am new to Hibernate and having trouble converting the below Native SQL query to Hibernate Query using Criteria.


SELECT REL_ROL4.RELATED_RELATIONSHIP_ID AS RELATIONSHIP_ID ,
REL_ROL1.RELATED_LEGAL_ENTITY_ID AS provider_id,
REL_ROL2.RELATED_LEGAL_ENTITY_ID AS legal_entity_of_interest ,
REL_ROL3.RELATED_LEGAL_ENTITY_ID AS consumer_id
FROM RELATIONSHIP_ROLE REL_ROL4
JOIN RELATIONSHIP_ROLE REL_ROL1
ON REL_ROL4.RELATED_RELATIONSHIP_ID = REL_ROL1.RELATIONSHIP_ID
JOIN RELATIONSHIP_ROLE REL_ROL2
ON REL_ROL1.RELATIONSHIP_ID = REL_ROL2.RELATIONSHIP_ID
JOIN RELATIONSHIP_ROLE REL_ROL3
ON REL_ROL4.RELATIONSHIP_ID = REL_ROL3.RELATIONSHIP_ID
JOIN provider prov
ON REL_ROL1.RELATED_LEGAL_ENTITY_ID = prov.LEGAL_ENTITY_ID
JOIN consumer cons
ON REL_ROL3.RELATED_LEGAL_ENTITY_ID = cons.LEGAL_ENTITY_ID
WHERE REL_ROL3.RELATED_LEGAL_ENTITY_ID =1251
AND REL_ROL2.RELATED_LEGAL_ENTITY_ID != REL_ROL1.RELATED_LEGAL_ENTITY_ID;

Please help.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Native SQL Query to Hibernate Query using Criteria
 
Similar Threads
Can we execute sql query with outer join in hibernate
Query Execution in Hibernate
best way for storing Java objects into DB
JDBCExceptionReport and Hibernate
Online test application