I'm using Nhibernate with Nhibernate.Mapping.Attributes.
I can easily create a schema and it work perfectly, if I do simple update
like adding columns everything goes well, my DB is correctly updated.
If I add a new sub subclass the schema is correctly updated and the DB too
but I get this exception
Cannot instantiate abstract class or interface:
AEGestioneRicevute.Entities.Dichiarazione|| in
NHibernate.Tuple.PocoInstantiator.Instantiate() in
d:\CSharp\NH\NH\nhibernate\src\NHibernate\Tuple\PocoInstantiator.cs:line 89
the only way I have to make it work is to drop and create from zero the
whole DB, but is not what I like to do.
this is a piece of my class mapping
(base)
[HibernateMapping(0, Schema = "Schema", DefaultAccessType =
typeof(int), AutoImport = true, Namespace = "AEGestioneRicevute.Entities",
Assembly = "AEGestioneRicevute")]
[Class (1, Table = "Dichiarazione", NameType = typeof(Dichiarazione),
Abstract = true, SelectBeforeUpdate = false)]
public abstract class Dichiarazione
{
ID_Dichiarazione dichID;
[CompositeId(2, Name = "Dichiarazione_ID", ClassType =
typeof(ID_Dichiarazione))]
[KeyProperty(3, Name = "Progressivo", Column = "IDProgressivo",
Type = "string")]
[KeyProperty(4, Name = "Protocollo", Column = "IDProtocollo", Type
= "string")]
[KeyProperty(4, Name = "CodiceFornitura", Column =
"IDCodiceFornitura", Type = "string")]
public virtual ID_Dichiarazione Dichiarazione_ID
{
get { return dichID; }
set { dichID = value; }
}
(first subclass)
[HibernateMapping(20, Schema = "Schema", DefaultAccessType =
typeof(int), AutoImport = true, Namespace = "AEGestioneRicevute.Entities",
Assembly = "AEGestioneRicevute")]
[JoinedSubclass(21, ExtendsType = typeof(Dichiarazione), Table =
"DichiarazioneUnici", NameType = typeof(DichiarazioneUnici), Abstract =
true)]
public abstract class DichiarazioneUnici : Dichiarazione
{
[Key(22)]
[Column(23, Name = "Progressivo")]
[Column(24, Name = "Protocollo")]
[Column(25, Name = "CodiceFornitura")]
(sub subclass)
[HibernateMapping(50, Schema = "Schema", DefaultAccessType =
typeof(int), AutoImport = true, Namespace = "AEGestioneRicevute.Entities",
Assembly = "AEGestioneRicevute")]
[JoinedSubclass(51, ExtendsType = typeof(DichiarazioneUnici), Table =
"UnicoIVD", NameType = typeof(UnicoIVD))]
public class UnicoIVD : DichiarazioneUnici
{
[Key(200)]
[Column(201, Name = "Protocollo")]
[Column(202, Name = "Progressivo")]
[Column(203, Name = "CodiceFornitura")]
Any idea?
Thanks in advance
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/nhusers/-/uI-u9dsZD5oJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en.