[hibernate-users] Example Implementation of ResultTransformer

Jason Ferguson fergusonjason at gmail.com
Sat Apr 19 11:59:39 EDT 2008


Does anyone have an example of a fairly verbose ResultTransformer
implementation that they can share?

I'm trying to implement a Nested Set transformer, based on code
provided by Christian Bauer in the project JIRA, but his
implementation won't quite work for me as it stands now (excellent,
well-documented code, though).

The ResultTransformer interface specifies two methods:

- List transformList(List collection)
- Object transformTuple(Object[] tuple, String[] alias)

I do not understand the purpose of transformList(): most
implementations are one line long, simply returning whatever was
passed to it.

I have a partial understanding of transformTuple(). The tuple
corresponds to the resultset (i.e. tuple[0] equates (bad term there, I
know) to resultSet.getXXX(0)). The alias array corresponds to any
aliases defined in the SQL.

Thanks for any help.

Jason



More information about the hibernate-users mailing list