Win a copy of JDBC Workbook this week in the JDBC and Relational Databases forum
or A Day in Code in the A Day in Code forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • salvin francis
  • fred rosenberger

How to createCriteria using joins?

Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

Any one help me createCriteria using Joins ...
Please find the given below joins query :

public List getJobseekerWorkExperience(Integer id) {

StringBuffer selectClause = new StringBuffer(
" select jswe.employerName, jswe.employerAddress, jswe.startFrom, jswe.endTo, jswe.visible, jswe.sortOrder, ");
.append(" jswel.businessSector, jswel.occupationTitle, jswel.mainActivities, ");
StringBuffer fromClause = new StringBuffer(
" from CvoJsWorkExperience as jswe, ");
fromClause.append(" CvoJsWorkExperienceLingual as jswel ");
StringBuffer whereClause = new StringBuffer(
" where and jswe.cvoJobseeker= ");
StringBuffer orderbyClause = new StringBuffer(
" order by jswe.sortOrder ");

Query q = session.createQuery(selectClause.toString()
+ fromClause.toString() + whereClause.toString()
+ orderbyClause.toString());
List results = q.list();
return results;

author and cow tipper
Posts: 5000
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, remember, Hibernate is object based. You can show me all the SQL in the world, but if I don't know what your object model is, I can't write one single line of object based criteria code.

Maybe a quick tutorial on using the Hibernate API is what you need. Check out this quick little tutorial:

How to Use the Criteria API to Query the Database.3

-Cameron McKenzie
Quick! Before anybody notices! Cover it up with this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
    Bookmark Topic Watch Topic
  • New Topic