mjgirl
mjgirl

Reputation: 1234

hibernate sql query

I'm trying to implement my very first hibernate sql query

public List<Subjectgrouplist> getSubjectgroups() {
    return hibernateTemplate.find("from subjectgrouplist where id > 0");
}

I'm trying to return all of the table. I know the where clause is not suitable, but I still tried it out. Can someone tell me how to build the query?

I aim is to print the list in jsp with foreach-tag.

Upvotes: 0

Views: 290

Answers (1)

Bohemian
Bohemian

Reputation: 424973

Try this:

public List<Subjectgrouplist> getSubjectgroups() {
    return hibernateTemplate.find("from SubjectGroup x where x.id > 0");
}

Upvotes: 1

Related Questions