When a computed property is placed inside a <composite-element> block an exception is raised.. {"Unable to cast object of type 'NHibernate.Mapping.Formula' to type 'NHibernate.Mapping.Column'";}
When a computed property is placed inside a <composite-element> block an exception is raised.. {"Unable to cast object of type 'NHibernate.Mapping.Formula' to type 'NHibernate.Mapping.Column'";}
When a computed property is placed inside a <composite-element> block an exception is raised..
{"Unable to cast object of type 'NHibernate.Mapping.Formula' to type 'NHibernate.Mapping.Column'";}
The test case:
sql:
CREATE TABLE TEST_TABLE1
(
ID1 NUMBER,
PROP1 VARCHAR2(10 BYTE)
);
CREATE TABLE TEST_TABLE2
(
ID2 NUMBER,
ID1 NUMBER NOT NULL,
PRO2 NVARCHAR2(10)
);
ALTER TABLE TEST_TABLE1 ADD (
CONSTRAINT PK_TEST_TABLE1 PRIMARY KEY (ID1));
ALTER TABLE TEST_TABLE2 ADD (
CONSTRAINT PK_TEST_TABELE2 PRIMARY KEY (ID2));
ALTER TABLE TEST_TABLE2 ADD (
CONSTRAINT FK1_TEST_TABLE2 FOREIGN KEY (ID1)
REFERENCES TEST_TABLE1 (ID1));
c#:
public class Class1
{
private int _id;
public virtual int Id
{
get { return _id; }
set { _id = value; }
}
private String _prop1;
public virtual String Prop1
{
get { return _prop1; }
set { _prop1 = value; }
}
private IList<Class2> _elements;
public virtual IList<Class2> Elements
{
get { return _elements; }
set { _elements = value; }
}
}
public class Class2
{
private int _id;
public virtual int Id
{
get { return _id; }
set { _id = value; }
}
private String _prop2;
public virtual String Prop2
{
get { return _prop2; }
set { _prop2 = value; }
}
mapping:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="Class1" table="TEST_TABLE1" mutable="true" lazy="false">
<id name="Id" column="ID1" type="Int32">
<generator class="assigned" />
</id>
<property name="Prop1" column="PROP1" not-null="true"/>
<bag name="Elements" lazy="false" cascade="all" table="TEST_TABLE2">
<key column="ID1"/>
<composite-element class="Class2">
<property name="Id" column="ID2" not-null="true"/>
<property name="Prop2" formula="( 'DUMMY -' || PRO2 )" not-null="true"/>
</composite-element>
</bag>
</class>
</hibernate-mapping>
When a computed property is placed inside a <composite-element> block an exception is raised..
{"Unable to cast object of type 'NHibernate.Mapping.Formula' to type 'NHibernate.Mapping.Column'";}