You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by Jacques Belissent <jb...@gmail.com> on 2008/03/20 07:22:10 UTC

DelegatingResultList.subList not implemented?

Hi,

I am getting the following exception when using OpenJPA 1.0.2.

Looks like subList is not implemented.  Is this expected?  Is there a
workaround?

java.lang.UnsupportedOperationException
        at org.apache.openjpa.lib.rop.AbstractResultList.subList(
AbstractResultList.java:84)
        at org.apache.openjpa.kernel.DelegatingResultList.subList(
DelegatingResultList.java:308)
        ...

Thanks.
Jacques

Re: DelegatingResultList.subList not implemented?

Posted by Rajeev Jha <jh...@gmail.com>.
Hello
we also had issues with using sublist and now I do not remember now
where/how I associated it to apache common lib versions. it could be
common-collections and *not* common-lang.

I see this

	//result = isNextPage() ? results.subList(0, pageSize) : results;
	// some problem with sublist , need to fix later

in old code and the new code is working with sublist w/o explicit casts.

results = query.setFirstResult(pageNum * pageSize)
           .setMaxResults(pageSize + 1)
           .getResultList();

result = getHasNextPage() ? results.subList(0, pageSize) : results;

we are using
commons-lang-2.1
commons-collections-3.2
commons-chain-1.1
commons-beanutils-1.7.0

may be worth a try if everything else fails.


Thanks

- rajeev.



On Fri, Mar 21, 2008 at 6:46 AM, francisco treacy
<fr...@gmail.com> wrote:
> jacques,
>
>  imho no relation to commons-lang.
>
>  given openjpaList and the start/end indexes, you should try grabbing
>  the list provided by openjpa, and doing this:
>
>  List sublist = new ArrayList(openjpaList).subList(fromIndex, toIndex);
>
>  hth,
>
>  francisco
>
>
>
>  On Thu, Mar 20, 2008 at 1:37 PM, Jacques Belissent <jb...@gmail.com> wrote:
>  > Hi Rajeev,
>  >
>  >  I get the same behavior with both 2.3 and 2.4.
>  >
>  >  Jacques
>  >
>  >
>  >
>  >
>  >
>  >  On Thu, Mar 20, 2008 at 12:46 AM, Rajeev Jha <jh...@gmail.com> wrote:
>  >
>  >  > can you try with latest version of apache common-lang? what is your
>  >  > current version of comman-lang?
>  >  >
>  >  > On Thu, Mar 20, 2008 at 11:52 AM, Jacques Belissent <jb...@gmail.com>
>  >  > wrote:
>  >  > > Hi,
>  >  > >
>  >  > >  I am getting the following exception when using OpenJPA 1.0.2.
>  >  > >
>  >  > >  Looks like subList is not implemented.  Is this expected?  Is there a
>  >  > >  workaround?
>  >  > >
>  >  > >  java.lang.UnsupportedOperationException
>  >  > >         at org.apache.openjpa.lib.rop.AbstractResultList.subList(
>  >  > >  AbstractResultList.java:84)
>  >  > >         at org.apache.openjpa.kernel.DelegatingResultList.subList(
>  >  > >  DelegatingResultList.java:308)
>  >  > >         ...
>  >  > >
>  >  > >  Thanks.
>  >  > >  Jacques
>  >  > >
>  >  >
>  >
>

Re: DelegatingResultList.subList not implemented?

Posted by francisco treacy <fr...@gmail.com>.
jacques,

imho no relation to commons-lang.

given openjpaList and the start/end indexes, you should try grabbing
the list provided by openjpa, and doing this:

List sublist = new ArrayList(openjpaList).subList(fromIndex, toIndex);

hth,

francisco

On Thu, Mar 20, 2008 at 1:37 PM, Jacques Belissent <jb...@gmail.com> wrote:
> Hi Rajeev,
>
>  I get the same behavior with both 2.3 and 2.4.
>
>  Jacques
>
>
>
>
>
>  On Thu, Mar 20, 2008 at 12:46 AM, Rajeev Jha <jh...@gmail.com> wrote:
>
>  > can you try with latest version of apache common-lang? what is your
>  > current version of comman-lang?
>  >
>  > On Thu, Mar 20, 2008 at 11:52 AM, Jacques Belissent <jb...@gmail.com>
>  > wrote:
>  > > Hi,
>  > >
>  > >  I am getting the following exception when using OpenJPA 1.0.2.
>  > >
>  > >  Looks like subList is not implemented.  Is this expected?  Is there a
>  > >  workaround?
>  > >
>  > >  java.lang.UnsupportedOperationException
>  > >         at org.apache.openjpa.lib.rop.AbstractResultList.subList(
>  > >  AbstractResultList.java:84)
>  > >         at org.apache.openjpa.kernel.DelegatingResultList.subList(
>  > >  DelegatingResultList.java:308)
>  > >         ...
>  > >
>  > >  Thanks.
>  > >  Jacques
>  > >
>  >
>

Re: DelegatingResultList.subList not implemented?

Posted by Jacques Belissent <jb...@gmail.com>.
Hi Rajeev,

I get the same behavior with both 2.3 and 2.4.

Jacques



On Thu, Mar 20, 2008 at 12:46 AM, Rajeev Jha <jh...@gmail.com> wrote:

> can you try with latest version of apache common-lang? what is your
> current version of comman-lang?
>
> On Thu, Mar 20, 2008 at 11:52 AM, Jacques Belissent <jb...@gmail.com>
> wrote:
> > Hi,
> >
> >  I am getting the following exception when using OpenJPA 1.0.2.
> >
> >  Looks like subList is not implemented.  Is this expected?  Is there a
> >  workaround?
> >
> >  java.lang.UnsupportedOperationException
> >         at org.apache.openjpa.lib.rop.AbstractResultList.subList(
> >  AbstractResultList.java:84)
> >         at org.apache.openjpa.kernel.DelegatingResultList.subList(
> >  DelegatingResultList.java:308)
> >         ...
> >
> >  Thanks.
> >  Jacques
> >
>

Re: DelegatingResultList.subList not implemented?

Posted by Rajeev Jha <jh...@gmail.com>.
can you try with latest version of apache common-lang? what is your
current version of comman-lang?

On Thu, Mar 20, 2008 at 11:52 AM, Jacques Belissent <jb...@gmail.com> wrote:
> Hi,
>
>  I am getting the following exception when using OpenJPA 1.0.2.
>
>  Looks like subList is not implemented.  Is this expected?  Is there a
>  workaround?
>
>  java.lang.UnsupportedOperationException
>         at org.apache.openjpa.lib.rop.AbstractResultList.subList(
>  AbstractResultList.java:84)
>         at org.apache.openjpa.kernel.DelegatingResultList.subList(
>  DelegatingResultList.java:308)
>         ...
>
>  Thanks.
>  Jacques
>