openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevin Sutter <kwsut...@gmail.com>
Subject Re: subclass lazy fetching
Date Tue, 09 Nov 2010 17:55:35 GMT
Hi Stephen,
Check out the complete FetchPlan interface [1].  The addField would add
another field to be fetched.  The removeField does the opposite and removes
the field from fetching.

You could search through our JUnits to see if there's an example (I don't
have access at the moment).

Kevin

[1]
http://openjpa.apache.org/builds/2.0.1/apache-openjpa-2.0.1/docs/javadoc/org/apache/openjpa/persistence/FetchPlan.html

On Tue, Nov 9, 2010 at 11:20 AM, Stephen Hallinan <
Stephen.Hallinan@elasticpath.com> wrote:

> Hi Kevin
>
> Do you mean example 5.22 ?
>
> OpenJPAEntityManager kem = OpenJPAPersistence.cast(em);
> kem.getFetchPlan().addField(Magazine.class, "publisher");
> Magazine mag = em.find(Magazine.class, magId);
>
>
> I can see how this would add another field to be eagerly fetched -- but I
> don't see how I could modify an attribute in the default fetch plan to be
> lazily fetched, unless there was some way to override the annotation for the
> particular class either in a subclass or xml ...
>
> Can you elaborate or provide a code sample for what you mean?
>
> Thanks,
>
> Stephen
>
>
>
> --------------------------------------------------------------------------
> Stephen Hallinan, Software Engineer
> Phone 604.408.8078 ext. 258
> Mobile: 778.668.8654
> Email: Stephen.Hallinan@elasticpath.com
>
> Elastic Path Software, Inc.
> Web: www.elasticpath.com
> Blog: www.getelastic.com
> Community: grep.elasticpath.com
> Careers: www.elasticpath.com/jobs
>
> Confidentiality Notice: This message is intended only for the use of the
> designated addressee(s), and may contain information that is privileged,
> confidential and exempt from disclosure. Any unauthorized viewing,
> disclosure, copying, distribution or use of information contained in this
> e-mail is prohibited and may be unlawful. If you received this e-mail in
> error, please reply to the sender immediately to inform us you are not the
> intended recipient and delete the email from your computer system. Thank
> you.
>
> -----Original Message-----
>
> From: Kevin Sutter [mailto:kwsutter@gmail.com]
> Sent: November 9, 2010 6:08 AM
> To: users@openjpa.apache.org
> Subject: Re: subclass lazy fetching
>
> Hi Stephen,
> Check out Fetch Groups and Fetch Plans [1].  Towards the end of this
> section, it shows an example of overriding the fetch plan to make an
> attribute EAGER.  You should be able to do a similar operation for LAZY
> loading.  This is an OpenJPA extension is not part of the JPA spec.
>
> Kevin
>
> [1]
>
> http://openjpa.apache.org/builds/2.0.1/apache-openjpa-2.0.1/docs/manual/manual.html#ref_guide_fetch
>
> On Mon, Nov 8, 2010 at 3:11 PM, Stephen Hallinan <
> Stephen.Hallinan@elasticpath.com> wrote:
>
> > Hi
> >
> > I have a scenario whereby I'd like to subclass an entity, and override a
> > couple of the fields to have the fetch type LAZY.
> >
> > In the super class they are EAGER.
> >
> > Is this possible ? In my tests so far it seems not to be the case but
> maybe
> > there are some aspects of implementation I'm not aware of.
> >
> > Thanks,
> >
> > Stephen
> >
> >
> >
> >
> --------------------------------------------------------------------------
> > Stephen Hallinan, Software Engineer
> > Phone 604.408.8078 ext. 258
> > Mobile: 778.668.8654
> > Email: Stephen.Hallinan@elasticpath.com
> >
> > Elastic Path Software, Inc.
> > Web: www.elasticpath.com
> > Blog: www.getelastic.com
> > Community: grep.elasticpath.com
> > Careers: www.elasticpath.com/jobs
> >
> > Confidentiality Notice: This message is intended only for the use of the
> > designated addressee(s), and may contain information that is privileged,
> > confidential and exempt from disclosure. Any unauthorized viewing,
> > disclosure, copying, distribution or use of information contained in this
> > e-mail is prohibited and may be unlawful. If you received this e-mail in
> > error, please reply to the sender immediately to inform us you are not
> the
> > intended recipient and delete the email from your computer system. Thank
> > you.
> >
> >
> >
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message