Reverse Map Views

Thread is closed for posting
3 posts, 0 answers
  1. Nick Wood
    Nick Wood avatar
    126 posts
    Member since:
    Feb 2010

    Posted 15 Mar 2010 Link to this post

    Hi There

    how can we reverse map a view without a primary key. In most cases, views are combinations of other tables and may or may not have a primary key for the view, but I keep getting "No primary key errors".

    How can I get arround this?
  2. Alexander
    Admin
    Alexander avatar
    727 posts

    Posted 15 Mar 2010 Link to this post

    Hello Nick Wood,

    I am afraid this is not possible at the moment. It is a requirement of the OpenAccess' runtime that each class has an identity field. Note that it is not required that the column mapped to the identity field should be a primary key. However, if there are duplicating values in that column, you will get duplicating results when executing a query (e.g. instead of retrieving three different objects you will get the first one three times) due to the caching mechanism. To avoid such behavior you can mark as identity several fields that form a combination which identifies each row uniquely. Hope that helps.

    Kind regards,
    Alexander
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. Sergej Mertens
    Sergej Mertens avatar
    34 posts
    Member since:
    May 2009

    Posted 15 Mar 2010 Link to this post

    Hi Nick,

    check this out: http://blogs.telerik.com/openaccessteam/posts/09-07-13/reverse_mapping_and_using_database_views_with_telerik_openaccess_orm.aspx

    Especially: "... Note that views without primary key columns are not currently supported..."
    and
     "... NOTE: It is user’s responsibility to set a real primary key – in the case where no real identity column is included in the view, you should use a composite key developed by including multiple columns from the available, trying to produce unique combination – usually meaning that all of the columns should be marked as such. ..."

    Greetings,
    Daniel
Back to Top