This is a migrated thread and some comments may be shown as answers.

One-to-many ordered list

1 Answer 64 Views
Databases and Data Types
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jay
Top achievements
Rank 1
Jay asked on 21 Sep 2009, 04:57 PM
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))]

Thanks

1 Answer, 1 is accepted

Sort by
0
PetarP
Telerik team
answered on 24 Sep 2009, 11:11 AM
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,
Petar
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.
Tags
Databases and Data Types
Asked by
Jay
Top achievements
Rank 1
Answers by
PetarP
Telerik team
Share this question
or