Hi,
Really you should give a little bit more info to be sure to give
you a correct answer....
But..... I´ll give it a try....
If you use Criteria... than you can use the method setResultTransFormer
and pass a AliasToBeanTransformer...
more or less like this:
Code:
Criteria s = session.createCriteria
..... do what ever is necessary
.setProjection(Projections.projectionList()
.add(Projections.property()
..... do more stuff if you want
)
)
.setResultTransformer( new AliasToBeanResultTransformer (<yourdto>.class) )
);
Now your DTO has to have properties with the same name and type as you return
in your Criteria..... and you are on your way... so it is not exactly take it from teh database and throw what ever comes back in my DTO but it comes close ..... I guess
Hope this will help you a bit
Good Luck