ORMs inheritance support
I'm trying to map two tables in one Entities as these tables is really one entity. I've tried llblgen and Visual NHibernate without any success as both designers
Visual NHibernate can't see one to one relationship, however I've implemented it. Maybe my database schema didn't satisfy all requirements for such inheritance implementation. However I thought th开发者_开发百科at all I need is to have one to one relationship to make this type of inheritance.
Maybe some of you guys have already tried it?
Edit: Adding tables picture
I want my following class
public class Expense {
public int Id {get; set;}
public int Type {get; set;}
public decimal Amount {get; set;}
public string SomeAdditionalInfo {get; set;}
}
You're going to want to take a look at the Hibernate documentation for inheritance mapping, specifically the table-per-hierarchy model. You say you can make Transact abstract and have Expense inherit from it, so I think this should solve your problem if I understand it correctly.
http://docs.jboss.org/hibernate/core/3.5/reference/en/html/inheritance.html
Alternatively, if you don't want to use the table-per-hierarchy method, there's a couple other ways you could achieve your goal outlined in that link.
精彩评论