开发者

Fluent Hibernate Automapping issues in table definition (all indices not null)

Title: multiple class with same variable name list has issues in table definition (all indices not null)

lets say i have two class implementing from one interface

public interface IInterface1
{
   IList<string> myList {get; set;}
}

public class class1 : IInterface1
{
    IList <string> myList {get; set;}
    public class1()
    {
       myList = new List<string>();
    }
}

public class class2 : IInterface1
{
    IList<string> myList {get; set;}
    public class2()
    {
       myList = new List<string>();
    }
}

when the table is created the for myList the table definition would be like

  1. class1_id 'not null = true'
  2. value
  3. class2_id 'not null = true'

when you try to save a 开发者_StackOverflow社区value it will fail since it will always have only one id value at a time.

when class1 is saved only only class1_id can be saved and class2_id will be empty this would cause the insert to fail with error

'could not insert collection:.....VALUES (?p0, ?p1)]'
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜