Nhibernate: QuerySyntaxException: "Class" is not displayed
I have the following class:
public class MyClass
{
private List<long> _myList = new List<long>();
public virtual string MyID { get; set; }
public virtual string MyData
{
get
{
return SomeStaticClass.Serialize(_myList);
}
set
{
_myList = SomeStaticClass.Deserialize<List<long>>(value);
}
}
public virtual List<long> MyList
{
get { return _myList; }
}
}
And the following mapping file:
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
assembly="MyNamespace"
namespace="MyNamespace">
<class name="MyNamespace.MyClass" table="MY_TABLE">
<id name="MyID" column="MY_ID" type="System.String">
<generator class="assigned"></generator>
</id>
<property name="MyData" column="MY_DATA"></property>
</class>
</hibernate-mapping>
When I try to run the following line:
session.Delete("From MyClass m");
I get a QuerySyntaxException with the message "MyClass is not displayed [From MyClass s]".
When I change the field name "MyID" to "ID" in the mapping file, the exception becomes
NHibernate.PropertyNotFoundException: Failed to find getter for property id in class 'MyNamespace.MyClass'.
, . , , , . ? , MyList, , , .
EDIT: , MyData MyList . - .
2: get; ; . . , nhibernate , , , PropertyNotFound "class in not mapping".
![1]](/img/f19f49e9bd72e2c5a013bcea052eef1b.jpg)