What's it about?
The idea behind this small project is to let you do more with Hibernate Projections. If you have to make a lot of Hibernate criterias like I do, you probably have faced with the following situation.
Scenario
Let's imagine you have two entities, Person and Car. You can see them below:
Person
Car
I haven't mapped these classes with Hibernate annotations, but you probably got it.
Now, in this situation, what would you do to get the name of the car of a person?
You probably would set a Projection adding the fields you want to retrieve from the database, but if you use something like Criteria.setResultTransformer, it would fail because it does not support nested transform. So, here is where you can use our transformer.
Through the example below you can see how our transformer works.
On the line #12 we are declaring a possible result list from a criteria. Then, we only need to pass the root class type of our query, in this case Person, the criteria result list*, and the list of aliases. And, yeah, that's it. You will then get your your nested objects with its attributes set with their related values. Btw, you can find the whole code of this example here.
*You must not use Criteria.setResultTransformer
Bugs/Suggestions
Please, if you find a bug or something like that, contact me, I will try to fix ASAP. You can also make a pull request though =D