[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [eclipselink-users] Native queries...disturbing behavior...bug?
|
On Thu, Oct 7, 2010 at 8:17 AM, Christopher Delahunt
<christopher.delahunt@xxxxxxxxxx> wrote:
Using native queries to return entities cause problems when incomplete
or manipulated data is returned because these entities then become
managed entities. So unless it is a refresh query, the entities will
be loaded with only the results from the first query. The dont cache
and read-only options suggested in the link will prevent the query from
returning managed entities. You could also try the refresh query hint,
or you could build the entities yourself from the data returned.
Thanks! The act of emailing the list caused me to figure it out. :-P I solved the problem by augmenting the primary key of the entity that I'm building. In point of fact, I DO want them to be managed entities--or at least cached entities, so this does the trick for me.
I have found that it's too easy to get into the mindset of, "Oh, it's a native query, so now I'm just doing SQL". You're not just doing SQL, of course; you're still involving the persistence context as you point out.
Best,
Laird