Reputation: 22369
I have an @Entity Person.
I am creating a Criteria query for this entity and calling criteria.list().
This will return a List with several Person's in it.
This List I then iterate over to do some work, like generating a Json string.
Being obsessed with doing things as performant as possible, it would be ideal to work on the entities as they are generated and before being added to the list.
If possible, then I wouldn't have to iterate over them again.
Is this possible?
Upvotes: 0
Views: 70
Reputation: 3669
The 'some work' is based on complete object data, then there is no way, but if it is at attribute
level, then you could write your own '@Converter
' to do the work before mapping the column data to your entity.
And
If you want to retrieve the object as JSON then map your entity as JSON (use jackson hibernate).
Upvotes: 1