[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [eclipselink-users] Caching and @Id
|
Identity will always be maintain within the EntityManager, the cache settings
are just for the shared cache.
You could set the query to be read-only (query hint
"eclipselink.read-only"="true"), or disable the cache for the query (query
hint "eclipselink.maintain-cache"="false").
Otherwise, you could make every field in the object part of its Id if it
truely has no unique fields.
Zarar Siddiqi wrote:
>
> Hi,
>
> I'm have a native query whose results I stuff into an Entity. The
> query uses a LEFT JOIN and it's awfully hard figuring out uniqueness
> per row since the LEFT JOIN can return null columns.
>
> I've mapped the results to an @Entity which has one arbitrary column
> defined as an @Id (only because I have to). Since I have caching
> turned off completely:
>
> <property name="eclipselink.cache.type.default" value="NONE"/>
>
> I expect every entity mapped to be its own object. However, if the
> result set has three rows with the same value in the @Id field/column,
> the same Java object ends up being there three times instead of three
> different objects. I realize why it's doing this (looking at the @Id
> and saying "oh well, I already have this object so why map a new one")
> but want to change this behavior.
>
> I even tried messing with the cache size and shared cache properties
> but no luck.
>
> Any help would be appreciated.
>
> Zarar
>
>
-----
http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland
http://www.eclipse.org/eclipselink/
EclipseLink , http://www.oracle.com/technology/products/ias/toplink/
TopLink
Wiki: http://wiki.eclipse.org/EclipseLink EclipseLink ,
http://wiki.oracle.com/page/TopLink TopLink
Forums: http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink ,
http://www.nabble.com/EclipseLink-f26430.html EclipseLink
Book: http://en.wikibooks.org/wiki/Java_Persistence Java Persistence
--
View this message in context: http://old.nabble.com/Caching-and-%40Id-tp26784831p26800429.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.