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?
Take a look at these libraries:
from(user)
.leftJoin(tweet).on(user.id.eq(tweet.posterId))
.groupBy(user.username)
.list(Projections.constructor(UserInfo.class, user.username, tweet.id.count()));
dsl.insertInto(BOOK)
.set(BOOK.ID, id)
.set(BOOK.AUTHOR_ID, authorId)
.set(BOOK.TITLE, title)
.execute();