Often the most important part of the news is what they didn't tell.
Often the most important part of the news is what they didn't tell.
Tim Holloway wrote:I do this all the time, but I'm using Hibernate JPA, so what I actually inject is a DAO/data service object, not the Hibernate persistence context. The DAO in turn has an entityManager injected into it, but that's just a reference to the master entityManager that Spring created. The actual database connection is only acquired while a transaction is active. It can be (and is) safely released when the transaction ends. I'm using AOP transaction management mostly, but the same rules apply if you manage transactions manually.
Tim Holloway wrote:It's not generally performant to hit the database for every little thing, so when I pull dropdown menu labels from the persistent store, I acquire a detached copy and cache it in the application-scoped object. Actually, I also build the JSF SelectItem objects for that particular case, since I want as little redundant work as I can spare memory for.
Often the most important part of the news is what they didn't tell.
Stinging nettles are edible. But I really want to see you try to eat this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
|