You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Bruno René Santos <br...@holos.pt> on 2011/09/26 23:41:48 UTC

ClassCastException: PersistentObjectSet as PersistentObject

Hello all,

I was trying to use java.util.Set as the base of my relationships as my GUI
framework uses it a lot. The problem was that on this piece of code:

// TODO: Andrus 1/31/2006 - IncrementalFaultList is not properly
                        // transferred between contexts....

                        List childObjects = new ArrayList(objects.size());
                        Iterator it = objects.iterator();
                        while (it.hasNext()) {
                            Persistent object = (Persistent) it.next();

childObjects.add(targetContext.localObject(object
                                    .getObjectId(), object));
                        }

which is on ObjectContextQueryAction.java, the Persistent object =
(Persistent) it.next(); returns a Set instead of a single item. When I
change the relationship on the Modeler to use Lists everything returns to
normal.

Is this a bug?

Regards
Bruno Santos

-- 
Bruno René Santos | brunorene@holos.pt | Gestor de Projectos | Analista |
Programador | Investigador

Holos - Soluções Avançadas em Tecnologias de Informação S.A.
Parque de Ciência e Tecnologia de Almada/Setúbal . Edifício Madan Parque
Rua dos Inventores . Quinta da Torre . 2825 - 182 Caparica . Portugal
Phone: +351 210 438 686 . Fax: +351 210 438 687 . Web: www.holos.pt

This email and any files transmitted with it are confidential and intended
solely for the use of the individual or entity to whom they are addressed.
If you are not the intended recipient or the person responsible for
delivering the email to the intended recipient, be advised that you have
received this email in error and that any use, dissemination, forwarding,
printing, or copying of this email is strictly prohibited. If you have
received this email in error please notify Bruno René Santos by telephone on
+351 210 438 686

Re: ClassCastException: PersistentObjectSet as PersistentObject

Posted by Andrus Adamchik <an...@objectstyle.org>.
Yes please open a bug report with a stack trace.

Andrus

On Sep 27, 2011, at 12:41 AM, Bruno René Santos wrote:

> Hello all,
> 
> I was trying to use java.util.Set as the base of my relationships as my GUI
> framework uses it a lot. The problem was that on this piece of code:
> 
> // TODO: Andrus 1/31/2006 - IncrementalFaultList is not properly
>                        // transferred between contexts....
> 
>                        List childObjects = new ArrayList(objects.size());
>                        Iterator it = objects.iterator();
>                        while (it.hasNext()) {
>                            Persistent object = (Persistent) it.next();
> 
> childObjects.add(targetContext.localObject(object
>                                    .getObjectId(), object));
>                        }
> 
> which is on ObjectContextQueryAction.java, the Persistent object =
> (Persistent) it.next(); returns a Set instead of a single item. When I
> change the relationship on the Modeler to use Lists everything returns to
> normal.
> 
> Is this a bug?
> 
> Regards
> Bruno Santos
> 
> -- 
> Bruno René Santos | brunorene@holos.pt | Gestor de Projectos | Analista |
> Programador | Investigador
> 
> Holos - Soluções Avançadas em Tecnologias de Informação S.A.
> Parque de Ciência e Tecnologia de Almada/Setúbal . Edifício Madan Parque
> Rua dos Inventores . Quinta da Torre . 2825 - 182 Caparica . Portugal
> Phone: +351 210 438 686 . Fax: +351 210 438 687 . Web: www.holos.pt
> 
> This email and any files transmitted with it are confidential and intended
> solely for the use of the individual or entity to whom they are addressed.
> If you are not the intended recipient or the person responsible for
> delivering the email to the intended recipient, be advised that you have
> received this email in error and that any use, dissemination, forwarding,
> printing, or copying of this email is strictly prohibited. If you have
> received this email in error please notify Bruno René Santos by telephone on
> +351 210 438 686