0

I am using http://www.mkyong.com/struts2/struts-2-hibernate-integration-with-full-hibernate-plugin/ as my refernce for struts+hibernate.I need to replace "return session.createQuery("from Customer").list();" in CustomerDAOIMPL.java with the following query

select u.Loginid,c.CID,CNAME,CTICKER,STOCKVALUE,VARIATE,VARIATE_PERCENT,PREVIOUS_DAY_STOCK,MARKET
from company_details c,users_details u,user_company uc where uc.loginpk=u.loginpk AND uc.CID=c.CID AND uc.loginpk IN (select LOGINPK from users_details where LOGINID="check")

how to do write such a query in HQL[Hibernate Query Language] I tried reading my tutorials for google but nothing go into my mind.Please help me,if possible give the link of tutorial for creating HQL from SQL involving Joining tables which is very simple to understand

1
  • If you are (completely)new to hibernate, I would recommend, start with converting simple sql to hql and then go for complex one. You'll definitely find those tutorial helpful. Besides for this sql, show your beans & mappings. Commented Oct 9, 2012 at 7:15

1 Answer 1

3

If you are beginner, go through these simple example's link:

For more reference : http://docs.jboss.org/hibernate/orm/3.3/reference/en/html/queryhql.html

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.