One-to-many ordered list

Thread is closed for posting
2 posts, 0 answers
  1. Jay
    Jay avatar
    28 posts
    Member since:
    Apr 2006

    Posted 21 Sep 2009 Link to this post

    Is it possible to have an ordered collection of persistent capable objects without using a link table?  Let's say I have a Product object with a list of ProductImage objects.  The ProductImage table has a DisplayOrder column that I'd like to use as the list sequence.  Since the ProductImage object will not belong to any other ordered collections, there is no need to have a link table that contains the sequence column.  If this is possible, what would the OA mapping look like?

    The NHibernate way of doing this with attributes looks like this
        [List(Lazy = false, Cascade = CascadeStyle.AllDeleteOrphan, Access = "field")]
        [Key(1, Column = "ProductId")]
        [Index(2, Column = "DisplayOrder")]
        [OneToMany(3, ClassType = typeof(ProductImage))]

  2. PetarP
    PetarP avatar
    754 posts

    Posted 24 Sep 2009 Link to this post

    Hi Ben Friedman,

    Unfortunately this is not possible. The only way to have this ordered collection would be to use join table.

    All the best,
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top