Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Cacheing non-root entities

Further investigation, shows that making the superclass non-cacheable will automatically make subclasses non-cacheable. Sorry for any confusion.

Non cacheable entries in EclipseLink are labeled protected. What that means is that they do not appear in the shared cache, but are cached at the EntityManager level.

-tom

On 06/06/2013 10:24 AM, Tom Ware wrote:
Hi Andreas,

   I have not tried this, but after discussing with a colleague, we think that
this configuration should work.  Doing things this way would create some
limitations on using things like EclipseLink's in-memory querying feature, but
as long as you are not specifically using it we think you will be ok.

-Tom

On 05/06/2013 4:08 AM, Andreas Joseph Krogh wrote:
I would like to cache, with @Cacheable, non-root entities.
Say you have this model:

@Entity
@Table(name =*"parent"*)
@Inheritance(strategy = InheritanceType.JOINED)
@DiscriminatorColumn(name =*"type"*, discriminatorType =
DiscriminatorType.STRING)
@SequenceGenerator(name =*"SEQ_STORE"*, sequenceName =*"entity_id_seq"*,
allocationSize =1)
*abstract class**AbstractEntityObject*  {

@Entity
@Table(name =*"child"*)
@PrimaryKeyJoinColumn(name =*"entity_id"*)
@DiscriminatorValue(*"PERSON"*)@Cacheable  /// This does not work in Hibernate
because we're not the Root-entity/
*class**Person*  *extends**AbstractEntityObject*

I want to cache /inherited/ entities of AbstractEntityObject but am unable to do
so in Hibernate because Hibernate only allows the root-entity,
AbstractEntityObject, to be cached.
Is this according to spec or a Hibernate-limitation? Is this possible in
EclipseLink? The point is that I don't want to cache *all* inherited entities of
AbstractEntityObject.
Thanks.
--
Andreas Joseph Krogh <andreak@xxxxxxxxxxxx>      mob: +47 909 56 963
Senior Software Developer / CTO - OfficeNet AS - http://www.officenet.no
Public key: http://home.officenet.no/~andreak/public_key.asc


_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users



Back to the top