You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by ka...@gmail.com on 2015/01/21 18:17:36 UTC
Eclipselink question
Hello! Those of You who use eclipselink have been a real help before. How do you manage http://eclipse.org/eclipselink/documentation/2.4/jpa/extensions/a_batchfetch.htm
You need this everywhere to get decent behavior but it cannot be configured globally :(
Cheers
Skickat från min iPhone
Re: Eclipselink question
Posted by Karl Kildén <ka...@gmail.com>.
Hi,
Sorry I did not investigate properly yet. Will do it this week but one
entity looks like this:
https://gist.github.com/karlkilden/4ee0297983b659c03787
Not even sure what the purpose of @ManyToOne is. In other places we have
only @JoinColumn and it works fine also. So yeah put @BatchFetch(value =
BatchFetchType.JOIN) on every foreign reference seems to do it... Otherwise
one select per row. Using a criteria query with no predicates for example
will fetch all rows with a select per row.
cheers
On 23 January 2015 at 07:59, Howard W. Smith, Jr. <sm...@gmail.com>
wrote:
> On Thu, Jan 22, 2015 at 5:59 PM, Andy Gumbrecht <ag...@tomitribe.com>
> wrote:
>
> > What do your actual db tables and entities look like? Can you supply some
> > details?
> >
> > Andy.
> >
> >
> > On 22/01/2015 19:10, Howard W. Smith, Jr. wrote:
> >
> >> Collections work well when I check isEmpty(), but I'm not using that
> >> notation. I'm still using eclipselink 2.3.2.
> >
> >
> In my app,
>
> ORDERS has Destinations, Origins, Customer, OrderCostDetails, etc...
>
> destinations and origins have address
> address has address lines, city, state, postal code (or zip code), country
>
> So, what I was referring to, earlier, was the following comment in my
> code[1] which is referenced when generating and doing processing related to
> an 'annual report' of previous year data.
>
> /*
> * Using isEmpty() on collections, instantiates the
> object; see below
> * http://stackoverflow.com/a/12100628/933054[2]
> */
>
> EclipseLink isEmpty() showed up in jvisualvm[3] when I was doing some
> performance monitoring of JSF pages in my app that is used by enduser to
> develop this annual report.
>
> [1] https://gist.github.com/8169ee34793a4babb502.git
> [2] http://stackoverflow.com/a/12100628/933054
> [3] http://s3.postimg.org/4vhkyquv7/20150112_perf_edit_Rolling_Stock.png
>
Re: Eclipselink question
Posted by "Howard W. Smith, Jr." <sm...@gmail.com>.
On Thu, Jan 22, 2015 at 5:59 PM, Andy Gumbrecht <ag...@tomitribe.com>
wrote:
> What do your actual db tables and entities look like? Can you supply some
> details?
>
> Andy.
>
>
> On 22/01/2015 19:10, Howard W. Smith, Jr. wrote:
>
>> Collections work well when I check isEmpty(), but I'm not using that
>> notation. I'm still using eclipselink 2.3.2.
>
>
In my app,
ORDERS has Destinations, Origins, Customer, OrderCostDetails, etc...
destinations and origins have address
address has address lines, city, state, postal code (or zip code), country
So, what I was referring to, earlier, was the following comment in my
code[1] which is referenced when generating and doing processing related to
an 'annual report' of previous year data.
/*
* Using isEmpty() on collections, instantiates the
object; see below
* http://stackoverflow.com/a/12100628/933054[2]
*/
EclipseLink isEmpty() showed up in jvisualvm[3] when I was doing some
performance monitoring of JSF pages in my app that is used by enduser to
develop this annual report.
[1] https://gist.github.com/8169ee34793a4babb502.git
[2] http://stackoverflow.com/a/12100628/933054
[3] http://s3.postimg.org/4vhkyquv7/20150112_perf_edit_Rolling_Stock.png
Re: Eclipselink question
Posted by Andy Gumbrecht <ag...@tomitribe.com>.
What do your actual db tables and entities look like? Can you supply
some details?
Andy.
On 22/01/2015 19:10, Howard W. Smith, Jr. wrote:
> Collections work well when I check isEmpty(), but I'm not using that
> notation. I'm still using eclipselink 2.3.2.
> On Jan 22, 2015 1:04 PM, <ka...@gmail.com> wrote:
>
>> Hello! I think something is weird in eclipselink. I need to reproduce but
>> if you do select item where supplier = selectedSupplier It is one select
>> per item even if item only has a elementcollection with a few values...
>>
>> Seems any kind of collection is unusable. Thanks for your input
>> Skickat från min iPhone
>>
>>> 22 jan 2015 kl. 14:20 skrev Andy Gumbrecht <ag...@tomitribe.com>:
>>>
>>> Hi Karl,
>>>
>>> Firstly ....Ouch, I know it is always tempting to use things like this
>> but I would not use it unless there was a really really good reason to use
>> it. It is not compatible with anything other than EL.
>>> If your child objects start to become so many that you are thinking of
>> batching the load then opt for a 'fetch = FetchType.LAZY' instead. This
>> means you would need to add an additional method to your service layer to
>> get the child objects. This is basically how you'd do it using JDBC too.
>>> final Parent p = service.getParent(long id);
>>>
>>> //List<Child> lc = p.getChildren(); <-- Hundreds of children, but null
>> list here if lazy loaded and detached...
>>> List<Child> lc = service.getChildren(p);
>>>
>>> If you still want to batch then do it manually:
>>>
>>> List<Child> lc = service.getChildren(p, start, end); //Pretty easy to
>> write your retrieval own loop here... eg. while !lc.isEmpty()
>>> Andy.
>>>
>>>> On 21/01/2015 18:17, karl.kilden@gmail.com wrote:
>>>> Hello! Those of You who use eclipselink have been a real help before.
>> How do you manage
>> http://eclipse.org/eclipselink/documentation/2.4/jpa/extensions/a_batchfetch.htm
>>>> You need this everywhere to get decent behavior but it cannot be
>> configured globally :(
>>>> Cheers
>>>>
>>>> Skickat från min iPhone
>>> --
>>> Andy Gumbrecht
>>> https://twitter.com/AndyGeeDe
>>> http://www.tomitribe.com
>>>
>
> --
> Andy Gumbrecht
> https://twitter.com/AndyGeeDe
> http://www.tomitribe.com
Re: Eclipselink question
Posted by "Howard W. Smith, Jr." <sm...@gmail.com>.
Collections work well when I check isEmpty(), but I'm not using that
notation. I'm still using eclipselink 2.3.2.
On Jan 22, 2015 1:04 PM, <ka...@gmail.com> wrote:
> Hello! I think something is weird in eclipselink. I need to reproduce but
> if you do select item where supplier = selectedSupplier It is one select
> per item even if item only has a elementcollection with a few values...
>
> Seems any kind of collection is unusable. Thanks for your input
> Skickat från min iPhone
>
> > 22 jan 2015 kl. 14:20 skrev Andy Gumbrecht <ag...@tomitribe.com>:
> >
> > Hi Karl,
> >
> > Firstly ....Ouch, I know it is always tempting to use things like this
> but I would not use it unless there was a really really good reason to use
> it. It is not compatible with anything other than EL.
> >
> > If your child objects start to become so many that you are thinking of
> batching the load then opt for a 'fetch = FetchType.LAZY' instead. This
> means you would need to add an additional method to your service layer to
> get the child objects. This is basically how you'd do it using JDBC too.
> >
> > final Parent p = service.getParent(long id);
> >
> > //List<Child> lc = p.getChildren(); <-- Hundreds of children, but null
> list here if lazy loaded and detached...
> >
> > List<Child> lc = service.getChildren(p);
> >
> > If you still want to batch then do it manually:
> >
> > List<Child> lc = service.getChildren(p, start, end); //Pretty easy to
> write your retrieval own loop here... eg. while !lc.isEmpty()
> >
> > Andy.
> >
> >> On 21/01/2015 18:17, karl.kilden@gmail.com wrote:
> >> Hello! Those of You who use eclipselink have been a real help before.
> How do you manage
> http://eclipse.org/eclipselink/documentation/2.4/jpa/extensions/a_batchfetch.htm
> >>
> >> You need this everywhere to get decent behavior but it cannot be
> configured globally :(
> >>
> >> Cheers
> >>
> >> Skickat från min iPhone
> >
> > --
> > Andy Gumbrecht
> > https://twitter.com/AndyGeeDe
> > http://www.tomitribe.com
> >
>
Re: Eclipselink question
Posted by ka...@gmail.com.
Hello! I think something is weird in eclipselink. I need to reproduce but if you do select item where supplier = selectedSupplier It is one select per item even if item only has a elementcollection with a few values...
Seems any kind of collection is unusable. Thanks for your input
Skickat från min iPhone
> 22 jan 2015 kl. 14:20 skrev Andy Gumbrecht <ag...@tomitribe.com>:
>
> Hi Karl,
>
> Firstly ....Ouch, I know it is always tempting to use things like this but I would not use it unless there was a really really good reason to use it. It is not compatible with anything other than EL.
>
> If your child objects start to become so many that you are thinking of batching the load then opt for a 'fetch = FetchType.LAZY' instead. This means you would need to add an additional method to your service layer to get the child objects. This is basically how you'd do it using JDBC too.
>
> final Parent p = service.getParent(long id);
>
> //List<Child> lc = p.getChildren(); <-- Hundreds of children, but null list here if lazy loaded and detached...
>
> List<Child> lc = service.getChildren(p);
>
> If you still want to batch then do it manually:
>
> List<Child> lc = service.getChildren(p, start, end); //Pretty easy to write your retrieval own loop here... eg. while !lc.isEmpty()
>
> Andy.
>
>> On 21/01/2015 18:17, karl.kilden@gmail.com wrote:
>> Hello! Those of You who use eclipselink have been a real help before. How do you manage http://eclipse.org/eclipselink/documentation/2.4/jpa/extensions/a_batchfetch.htm
>>
>> You need this everywhere to get decent behavior but it cannot be configured globally :(
>>
>> Cheers
>>
>> Skickat från min iPhone
>
> --
> Andy Gumbrecht
> https://twitter.com/AndyGeeDe
> http://www.tomitribe.com
>
Re: Eclipselink question
Posted by Andy Gumbrecht <ag...@tomitribe.com>.
Hi Karl,
Firstly ....Ouch, I know it is always tempting to use things like this
but I would not use it unless there was a really really good reason to
use it. It is not compatible with anything other than EL.
If your child objects start to become so many that you are thinking of
batching the load then opt for a 'fetch = FetchType.LAZY' instead. This
means you would need to add an additional method to your service layer
to get the child objects. This is basically how you'd do it using JDBC too.
final Parent p = service.getParent(long id);
//List<Child> lc = p.getChildren(); <-- Hundreds of children, but null
list here if lazy loaded and detached...
List<Child> lc = service.getChildren(p);
If you still want to batch then do it manually:
List<Child> lc = service.getChildren(p, start, end); //Pretty easy to
write your retrieval own loop here... eg. while !lc.isEmpty()
Andy.
On 21/01/2015 18:17, karl.kilden@gmail.com wrote:
> Hello! Those of You who use eclipselink have been a real help before. How do you manage http://eclipse.org/eclipselink/documentation/2.4/jpa/extensions/a_batchfetch.htm
>
> You need this everywhere to get decent behavior but it cannot be configured globally :(
>
> Cheers
>
> Skickat från min iPhone
--
Andy Gumbrecht
https://twitter.com/AndyGeeDe
http://www.tomitribe.com