0

I could not find anywhere if it possible to create metamodel over entites to be used in Hibernate's Criteria API. So I don't have to write strings for fields, but rather rely on the generated metamodel similarly as it can be done with JPA Criteria API.

I noticed that only Strings can be used as parameters in the Hibernate Criteria, so I guess it's not possible?

redhead
  • 1,264
  • 1
  • 17
  • 32

1 Answers1

1

Take a look at these libraries:

www.querydsl.com

from(user)
.leftJoin(tweet).on(user.id.eq(tweet.posterId))
.groupBy(user.username)
.list(Projections.constructor(UserInfo.class, user.username, tweet.id.count()));

www.jooq.org

dsl.insertInto(BOOK)
.set(BOOK.ID, id)
.set(BOOK.AUTHOR_ID, authorId)
.set(BOOK.TITLE, title)
.execute();
Nazarii Bardiuk
  • 4,272
  • 1
  • 19
  • 22