Hibernate Books

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: QueryOver Selectlist Select child collection out bounds
PostPosted: Mon Jun 11, 2012 6:52 am 
Newbie

Joined: Mon Jun 11, 2012 6:28 am
Posts: 1
Parent has one to many public virtual IList<Child> Children { get; set; }
Child has a one Parent property.

Code:
//In Parent Map

HasMany<Child>(x => x.Children)
              .Not.KeyNullable()
              .Inverse()
              .AsBag()
              .KeyColumns.Add("ParentId")
              ;

//In Child Map
References<Parent>(x => x.Parent)
              .ForeignKey()
              .Columns("ParentId")
              .Not.Nullable()
              .LazyLoad()
              ;

//Query that falls over
Child childAlias = null;

var myQuery = session.QueryOver<Parent>(() => parentAlias)
            .Inner.JoinAlias(x => x.Child, () => childAlias)
            .Where(() => childAlias.Parent.Id == 1)
            .SelectList(list => list
                .Select(x => x.Id).WithAlias(() => dmprd.ParentId)
                .Select(x => x.Child).WithAlias(() => dmprd.Children))
            .TransformUsing(Transformers.AliasToBean<SomeTarget>())
            .List<SomeTarget>();


.Select(x => x.Child).WithAlias causes an exception out of bounds error.

{"Index was outside the bounds of the array."}

Cant see it for the life of me why the child list is failing, the sql works if I paste into SQL Server query and return say Child.Id field.

Any ideas gratefully received.


Top
 Profile  
 
 Post subject: Re: QueryOver Selectlist Select child collection out bounds
PostPosted: Wed Jun 20, 2012 4:03 am 
Newbie

Joined: Wed Jun 20, 2012 3:31 am
Posts: 2
Thanks.There are assertive affidavit for the big sales of Beats by dre Not alone because of the fashoinable appearance, but the Exquisite ability and outstanding affection are the enthusiasts'favoutite. According to the news, the amount of Beats Solo appearance of Beats by Dre has fell to 1680 from 1999 back it was aboriginal produced.
_______________
beats by dr dre studio spiderman
beats by dre solo Purple
http://www.submitarticleforfree.in/?p=63336


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.