Here is what I am trying to do: 1. Send an HQL to populate "User" Hibernate object. 2. Send a native SQL to retrieve a smaller dataset from a very large data column from "User" table. 3. Combine the mapped Hibernate object with the column result from step 2.
I read that ResultTransformer can be used to map the resultset from 2 to a Hibernate entity, which in my case the "User" entity. Is there a way to insert the results of the ResultTransformer mapping to my original User entity?
Here's some example: 1. HQL - From User. We use Hibernate mapping file for User and using Bytecode Enhancement, we set "xmlStringColumn lazy=true". String hql = "FROM User";
List users = session.createQuery(hql).list(); 2. we send a query
List resultXML = s.createSQLQuery(
"XML SQL to get specific data")
.setResultTransformer( Transformers.aliasToBean(User.class))
.list();
User dto =(User) resultWithAliasedBean.get(0); //Will need code to combine the User dto from the SQL to the original