Dear Sirs,
i would like to accelerate my little web application,
when it loads some data in to a html table.
The table does not exactly match with a table on
the database. On the html-Pagetable there are
two or three additional columns, that needs to
be filled with data.
In order to prevent the application to create
an individual select for each line to get the
other data, i recognized the Criteria db access
as an way, to the dataload with one SQL JOIN
operation.
Code:
final Criteria myCrit = curSession.createCriteria(Table1Impl.class)
.createAlias("partList", "pPList", CriteriaSpecification.INNER_JOIN)
.setFetchMode("pPList", FetchMode.JOIN)
.addOrder( Order.asc("pr1") )
.addOrder( Order.asc("pPList.pr2") );
final List<Property> dbRes = (List<Property>)
myCrit.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY).list() ;
That was my solution. In the log i noticed the
creation of the SQL command i was exprected.
The DISTINCT_ROOT_ENTITY kicked out any
multiple occurence of data, also perfect.
But when the HTML-List Kode started, i saw (again)
a mass of simple SQL accesses on partList,
by calling .getPartList((). I thought HIBERNATE
has the data in his cache ???
Did i forget to configure something or shall i
better load the data in a different way ?
Thank you for your support!
Groovy