list() and findAll() return duplicated objects in list

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

list() and findAll() return duplicated objects in list

Pablo Pazos
Hi , I have a domain class "Role" and from a view I need to do Role.list(), but it returns each role repeated various times. I try Role.findAll() and I get the same behavior. In the database I see the roles created correctly, (I have 12 roles), when I print the result of Role.list() I get something like:

[auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 3, auth.Role : 3, auth.Role : 3, auth.Role : 3, auth.Role : 3, auth.Role : 3, auth.Role : 3, auth.Role : 4, auth.Role : 4, auth.Role : 4, auth.Role : 5, auth.Role : 5, auth.Role : 5, auth.Role : 5, auth.Role : 5, auth.Role : 5, auth.Role : 5, auth.Role : 5, auth.Role : 5, auth.Role : 5, auth.Role : 5, auth.Role : 5, auth.Role : 5, auth.Role : 5, auth.Role : 5, auth.Role : 5, auth.Role : 5, auth.Role : 5, auth.Role : 5, auth.Role : 5, auth.Role : 5, auth.Role : 5, auth.Role : 5, auth.Role : 5, auth.Role : 5, auth.Role : 5, auth.Role : 5, auth.Role : 5, auth.Role : 5, auth.Role : 5, auth.Role : 5, auth.Role : 5, auth.Role : 5, auth.Role : 5, auth.Role : 5, auth.Role : 5, auth.Role : 5, auth.Role : 5, auth.Role : 5, auth.Role : 5, auth.Role : 5, auth.Role : 5, auth.Role : 6, auth.Role : 6, auth.Role : 6, auth.Role : 6, auth.Role : 6, auth.Role : 6, auth.Role : 6, auth.Role : 6, auth.Role : 6, auth.Role : 6, auth.Role : 6, auth.Role : 6, auth.Role : 6, auth.Role : 6, auth.Role : 6, auth.Role : 7, auth.Role : 7, auth.Role : 7, auth.Role : 7, auth.Role : 7, auth.Role : 7, auth.Role : 7, auth.Role : 7, auth.Role : 7, auth.Role : 7, auth.Role : 7, auth.Role : 7, auth.Role : 7, auth.Role : 7, auth.Role : 7, auth.Role : 7, auth.Role : 7, auth.Role : 7, auth.Role : 8, auth.Role : 8, auth.Role : 8, auth.Role : 8, auth.Role : 8, auth.Role : 8, auth.Role : 8, auth.Role : 8, auth.Role : 8, auth.Role : 8, auth.Role : 8, auth.Role : 8, auth.Role : 8, auth.Role : 8, auth.Role : 8, auth.Role : 8, auth.Role : 8, auth.Role : 8, auth.Role : 8, auth.Role : 8, auth.Role : 8, auth.Role : 8, auth.Role : 8, auth.Role : 8, auth.Role : 8, auth.Role : 8, auth.Role : 8, auth.Role : 8, auth.Role : 8, auth.Role : 8, auth.Role : 8, auth.Role : 8, auth.Role : 9, auth.Role : 9, auth.Role : 9, auth.Role : 9, auth.Role : 9, auth.Role : 9, auth.Role : 9, auth.Role : 9, auth.Role : 9, auth.Role : 9, auth.Role : 9, auth.Role : 9, auth.Role : 9, auth.Role : 9, auth.Role : 10, auth.Role : 10, auth.Role : 10, auth.Role : 10, auth.Role : 10, auth.Role : 10, auth.Role : 10, auth.Role : 10, auth.Role : 10, auth.Role : 10, auth.Role : 10, auth.Role : 10, auth.Role : 10, auth.Role : 10, auth.Role : 11, auth.Role : 11, auth.Role : 11, auth.Role : 11, auth.Role : 11, auth.Role : 11, auth.Role : 11, auth.Role : 11, auth.Role : 11, auth.Role : 11, auth.Role : 11, auth.Role : 11, auth.Role : 11, auth.Role : 11, auth.Role : 12, auth.Role : 12, auth.Role : 12, auth.Role : 12, auth.Role : 12, auth.Role : 12, auth.Role : 12, auth.Role : 12, auth.Role : 12, auth.Role : 12, auth.Role : 12, auth.Role : 12, auth.Role : 12, auth.Role : 12]

I know I can do a .unique() and workaround this problem, but anybody knows why this is happening?
I'm using GRAILS 1.0.1 (upgraded from 0.6)

thanks,
Pablo Pazos Gutierrez
www.SimpleWebPortal.net SWP-CMS
Reply | Threaded
Open this post in threaded view
|

Re: list() and findAll() return duplicated objects in list

Robert Fletcher
Are you passing a criteria builder closure to .list or .findAll? Does
your Role class have any one to many relationships? That kind of
symptom is typically caused by relationships being fetched with an
outer join. I've seen that when using criteria queries with explicit
join fetches.

On 3/4/08, pablox <[hidden email]> wrote:

>
> Hi , I have a domain class "Role" and from a view I need to do Role.list(),
> but it returns each role repeated various times. I try Role.findAll() and I
> get the same behavior. In the database I see the roles created correctly, (I
> have 12 roles), when I print the result of Role.list() I get something like:
>
> [auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1,
> auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1,
> auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1,
> auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1,
> auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1,
> auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1,
> auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1,
> auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1,
> auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1,
> auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1,
> auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1,
> auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1,
> auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1,
> auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1,
> auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1,
> auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1,
> auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1,
> auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1,
> auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1,
> auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1,
> auth.Role : 1, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2,
> auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2,
> auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2,
> auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2,
> auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2,
> auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2,
> auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2,
> auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2,
> auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2,
> auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2,
> auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2,
> auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2,
> auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 3, auth.Role : 3,
> auth.Role : 3, auth.Role : 3, auth.Role : 3, auth.Role : 3, auth.Role : 3,
> auth.Role : 4, auth.Role : 4, auth.Role : 4, auth.Role : 5, auth.Role : 5,
> auth.Role : 5, auth.Role : 5, auth.Role : 5, auth.Role : 5, auth.Role : 5,
> auth.Role : 5, auth.Role : 5, auth.Role : 5, auth.Role : 5, auth.Role : 5,
> auth.Role : 5, auth.Role : 5, auth.Role : 5, auth.Role : 5, auth.Role : 5,
> auth.Role : 5, auth.Role : 5, auth.Role : 5, auth.Role : 5, auth.Role : 5,
> auth.Role : 5, auth.Role : 5, auth.Role : 5, auth.Role : 5, auth.Role : 5,
> auth.Role : 5, auth.Role : 5, auth.Role : 5, auth.Role : 5, auth.Role : 5,
> auth.Role : 5, auth.Role : 5, auth.Role : 5, auth.Role : 5, auth.Role : 5,
> auth.Role : 5, auth.Role : 5, auth.Role : 5, auth.Role : 5, auth.Role : 5,
> auth.Role : 6, auth.Role : 6, auth.Role : 6, auth.Role : 6, auth.Role : 6,
> auth.Role : 6, auth.Role : 6, auth.Role : 6, auth.Role : 6, auth.Role : 6,
> auth.Role : 6, auth.Role : 6, auth.Role : 6, auth.Role : 6, auth.Role : 6,
> auth.Role : 7, auth.Role : 7, auth.Role : 7, auth.Role : 7, auth.Role : 7,
> auth.Role : 7, auth.Role : 7, auth.Role : 7, auth.Role : 7, auth.Role : 7,
> auth.Role : 7, auth.Role : 7, auth.Role : 7, auth.Role : 7, auth.Role : 7,
> auth.Role : 7, auth.Role : 7, auth.Role : 7, auth.Role : 8, auth.Role : 8,
> auth.Role : 8, auth.Role : 8, auth.Role : 8, auth.Role : 8, auth.Role : 8,
> auth.Role : 8, auth.Role : 8, auth.Role : 8, auth.Role : 8, auth.Role : 8,
> auth.Role : 8, auth.Role : 8, auth.Role : 8, auth.Role : 8, auth.Role : 8,
> auth.Role : 8, auth.Role : 8, auth.Role : 8, auth.Role : 8, auth.Role : 8,
> auth.Role : 8, auth.Role : 8, auth.Role : 8, auth.Role : 8, auth.Role : 8,
> auth.Role : 8, auth.Role : 8, auth.Role : 8, auth.Role : 8, auth.Role : 8,
> auth.Role : 9, auth.Role : 9, auth.Role : 9, auth.Role : 9, auth.Role : 9,
> auth.Role : 9, auth.Role : 9, auth.Role : 9, auth.Role : 9, auth.Role : 9,
> auth.Role : 9, auth.Role : 9, auth.Role : 9, auth.Role : 9, auth.Role : 10,
> auth.Role : 10, auth.Role : 10, auth.Role : 10, auth.Role : 10, auth.Role :
> 10, auth.Role : 10, auth.Role : 10, auth.Role : 10, auth.Role : 10,
> auth.Role : 10, auth.Role : 10, auth.Role : 10, auth.Role : 10, auth.Role :
> 11, auth.Role : 11, auth.Role : 11, auth.Role : 11, auth.Role : 11,
> auth.Role : 11, auth.Role : 11, auth.Role : 11, auth.Role : 11, auth.Role :
> 11, auth.Role : 11, auth.Role : 11, auth.Role : 11, auth.Role : 11,
> auth.Role : 12, auth.Role : 12, auth.Role : 12, auth.Role : 12, auth.Role :
> 12, auth.Role : 12, auth.Role : 12, auth.Role : 12, auth.Role : 12,
> auth.Role : 12, auth.Role : 12, auth.Role : 12, auth.Role : 12, auth.Role :
> 12]
>
> I know I can do a .unique() and workaround this problem, but anybody knows
> why this is happening?
> I'm using GRAILS 1.0.1 (upgraded from 0.6)
>
> thanks,
> Pablo Pazos Gutierrez
> http://www.SimpleWebPortal.net www.SimpleWebPortal.net SWP-CMS
> --
> View this message in context:
> http://www.nabble.com/list%28%29-and-findAll%28%29-return-duplicated-objects-in-list-tp15836668p15836668.html
> Sent from the grails - user mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>
>

--
Sent from Google Mail for mobile | mobile.google.com

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: list() and findAll() return duplicated objects in list

Pablo Pazos
Hi,

No, I don't pass any closure, I just do .list() and .findAll().

This are the fields defined into Role:

   Internationalizable name
   String roleKey
   static belongsTo = Authorization          
   static hasMany = [ rolePermissions:RolePermission, authorizations:Authorization ]
   static fetchMode = [rolePermissions:'eager']

I have a manyToMany relationship between Authorization and Role.
Internationalizable, Autorization and RolePermission are domain classes too.

cheeers,
Pablo Pazos Gutierrez
www.SimpleWebPortal.net SWP-CMS


Robert Fletcher wrote
Are you passing a criteria builder closure to .list or .findAll? Does
your Role class have any one to many relationships? That kind of
symptom is typically caused by relationships being fetched with an
outer join. I've seen that when using criteria queries with explicit
join fetches.

On 3/4/08, pablox <pablo@mirigi.com> wrote:
>
> Hi , I have a domain class "Role" and from a view I need to do Role.list(),
> but it returns each role repeated various times. I try Role.findAll() and I
> get the same behavior. In the database I see the roles created correctly, (I
> have 12 roles), when I print the result of Role.list() I get something like:
>
> [auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1,
> auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1,
> auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1,
> auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1,
> auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1,
> auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1,
> auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1,
> auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1,
> auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1,
> auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1,
> auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1,
> auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1,
> auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1,
> auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1,
> auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1,
> auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1,
> auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1,
> auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1,
> auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1,
> auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1, auth.Role : 1,
> auth.Role : 1, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2,
> auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2,
> auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2,
> auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2,
> auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2,
> auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2,
> auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2,
> auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2,
> auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2,
> auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2,
> auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2,
> auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 2,
> auth.Role : 2, auth.Role : 2, auth.Role : 2, auth.Role : 3, auth.Role : 3,
> auth.Role : 3, auth.Role : 3, auth.Role : 3, auth.Role : 3, auth.Role : 3,
> auth.Role : 4, auth.Role : 4, auth.Role : 4, auth.Role : 5, auth.Role : 5,
> auth.Role : 5, auth.Role : 5, auth.Role : 5, auth.Role : 5, auth.Role : 5,
> auth.Role : 5, auth.Role : 5, auth.Role : 5, auth.Role : 5, auth.Role : 5,
> auth.Role : 5, auth.Role : 5, auth.Role : 5, auth.Role : 5, auth.Role : 5,
> auth.Role : 5, auth.Role : 5, auth.Role : 5, auth.Role : 5, auth.Role : 5,
> auth.Role : 5, auth.Role : 5, auth.Role : 5, auth.Role : 5, auth.Role : 5,
> auth.Role : 5, auth.Role : 5, auth.Role : 5, auth.Role : 5, auth.Role : 5,
> auth.Role : 5, auth.Role : 5, auth.Role : 5, auth.Role : 5, auth.Role : 5,
> auth.Role : 5, auth.Role : 5, auth.Role : 5, auth.Role : 5, auth.Role : 5,
> auth.Role : 6, auth.Role : 6, auth.Role : 6, auth.Role : 6, auth.Role : 6,
> auth.Role : 6, auth.Role : 6, auth.Role : 6, auth.Role : 6, auth.Role : 6,
> auth.Role : 6, auth.Role : 6, auth.Role : 6, auth.Role : 6, auth.Role : 6,
> auth.Role : 7, auth.Role : 7, auth.Role : 7, auth.Role : 7, auth.Role : 7,
> auth.Role : 7, auth.Role : 7, auth.Role : 7, auth.Role : 7, auth.Role : 7,
> auth.Role : 7, auth.Role : 7, auth.Role : 7, auth.Role : 7, auth.Role : 7,
> auth.Role : 7, auth.Role : 7, auth.Role : 7, auth.Role : 8, auth.Role : 8,
> auth.Role : 8, auth.Role : 8, auth.Role : 8, auth.Role : 8, auth.Role : 8,
> auth.Role : 8, auth.Role : 8, auth.Role : 8, auth.Role : 8, auth.Role : 8,
> auth.Role : 8, auth.Role : 8, auth.Role : 8, auth.Role : 8, auth.Role : 8,
> auth.Role : 8, auth.Role : 8, auth.Role : 8, auth.Role : 8, auth.Role : 8,
> auth.Role : 8, auth.Role : 8, auth.Role : 8, auth.Role : 8, auth.Role : 8,
> auth.Role : 8, auth.Role : 8, auth.Role : 8, auth.Role : 8, auth.Role : 8,
> auth.Role : 9, auth.Role : 9, auth.Role : 9, auth.Role : 9, auth.Role : 9,
> auth.Role : 9, auth.Role : 9, auth.Role : 9, auth.Role : 9, auth.Role : 9,
> auth.Role : 9, auth.Role : 9, auth.Role : 9, auth.Role : 9, auth.Role : 10,
> auth.Role : 10, auth.Role : 10, auth.Role : 10, auth.Role : 10, auth.Role :
> 10, auth.Role : 10, auth.Role : 10, auth.Role : 10, auth.Role : 10,
> auth.Role : 10, auth.Role : 10, auth.Role : 10, auth.Role : 10, auth.Role :
> 11, auth.Role : 11, auth.Role : 11, auth.Role : 11, auth.Role : 11,
> auth.Role : 11, auth.Role : 11, auth.Role : 11, auth.Role : 11, auth.Role :
> 11, auth.Role : 11, auth.Role : 11, auth.Role : 11, auth.Role : 11,
> auth.Role : 12, auth.Role : 12, auth.Role : 12, auth.Role : 12, auth.Role :
> 12, auth.Role : 12, auth.Role : 12, auth.Role : 12, auth.Role : 12,
> auth.Role : 12, auth.Role : 12, auth.Role : 12, auth.Role : 12, auth.Role :
> 12]
>
> I know I can do a .unique() and workaround this problem, but anybody knows
> why this is happening?
> I'm using GRAILS 1.0.1 (upgraded from 0.6)
>
> thanks,
> Pablo Pazos Gutierrez
> http://www.SimpleWebPortal.net www.SimpleWebPortal.net SWP-CMS
> --
> View this message in context:
> http://www.nabble.com/list%28%29-and-findAll%28%29-return-duplicated-objects-in-list-tp15836668p15836668.html
> Sent from the grails - user mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>
>

--
Sent from Google Mail for mobile | mobile.google.com

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email

Reply | Threaded
Open this post in threaded view
|

Re: list() and findAll() return duplicated objects in list

xgeoff

pablox wrote
Hi,

No, I don't pass any closure, I just do .list() and .findAll().

This are the fields defined into Role:

   Internationalizable name
   String roleKey
   static belongsTo = Authorization          
   static hasMany = [ rolePermissions:RolePermission, authorizations:Authorization ]
   static fetchMode = [rolePermissions:'eager']

I have a manyToMany relationship between Authorization and Role.
Internationalizable, Autorization and RolePermission are domain classes too.
As an experiment, I would remove the hasMany and fetchMode definitions from your domain and try it then. If this returns your roles properly, then you know the issue is with the way the hasMany relationship is defined, and someone with experience in defining those relationships (not me, unfortunately) can hopefully help you out.