Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Hibernate enhanced AliasToBeanResultTransformer that supports projecting one-to-one and many-to-one associations
Branch: master
Failed to load latest commit information. initial import Update


You can use this class as criteria trnsformer in Hibernate to bind associated beans to the target bean.

Usage Example:

class Person {
  private Long id;
  private String name;
  private Car car;
  // getters and setters

class Car {
  private Long id;
  private String color;
  // getters and setters

List<Person> getPeople() {
  ProjectionList projections = Projections.projectionList()

  Criteria criteria = getCurrentSession().createCriteria(Person.class)
    .createAlias("car", "c")
    .setResultTransformer(new AliasToBeanNestedResultTransformer(Person.class));

  return (List<Person>) criteria.list();

// each car of Person will be populated

This is working for one-to-one and many-to-one associations (or beans).

We can develop it to include collections and multi-level nested associations.

Something went wrong with that request. Please try again.