Hi,
I get a strange exception when loading data:
Code:
{"could not execute query\r\n[ select sequenceit0_.SequenceItemID as Sequence1_10_, sequenceit0_.SequenceID as SequenceID10_, sequenceit0_.ItemName as ItemName10_ from V_SEQUENCEITEMS sequenceit0_ ]\r\n[SQL: select sequenceit0_.SequenceItemID as Sequence1_10_, sequenceit0_.SequenceID as SequenceID10_, sequenceit0_.ItemName as ItemName10_ from V_SEQUENCEITEMS sequenceit0_]"}
DEBUG 17.08.09 08:45:29 [ 2684]: could not execute query
[ select sequenceit0_.SequenceItemID as Sequence1_10_, sequenceit0_.SequenceID as SequenceID10_, sequenceit0_.ItemName as ItemName10_ from V_SEQUENCEI
TEMS sequenceit0_ ]
WARN 17.08.09 08:45:29 [ 2684]: System.NullReferenceException: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
bei System.String.Concat(Object[] args)
bei NHibernate.Loader.Loader.Hydrate(IDataReader rs, Object id, Object obj, ILoadable persister, ISessionImplementor session, String[][] suffixedPropertyColumns)
bei NHibernate.Loader.Loader.LoadFromResultSet(IDataReader rs, Int32 i, Object obj, Type instanceClass, EntityKey key, LockMode lockMode, ILoadable rootPersister, ISessionImplementor session)
bei NHibernate.Loader.Loader.InstanceNotYetLoaded(IDataReader dr, Int32 i, ILoadable persister, EntityKey key, LockMode lockMode, EntityKey optionalObjectKey, Object optionalObject, IList hydratedObjects, ISessionImplementor session)
bei NHibernate.Loader.Loader.GetRow(IDataReader rs, ILoadable[] persisters, EntityKey[] keys, Object optionalObject, EntityKey optionalObjectKey, LockMode[] lockModes, IList hydratedObjects, ISessionImplementor session)
bei NHibernate.Loader.Loader.GetRowFromResultSet(IDataReader resultSet, ISessionImplementor session, QueryParameters queryParameters, LockMode[] lockModeArray, EntityKey optionalObjectKey, IList hydratedObjects, EntityKey[] keys, Boolean returnProxies)
bei NHibernate.Loader.Loader.DoQuery(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies)
bei NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies)
bei NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters)
ERROR 17.08.09 08:45:29 [ 2684]: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
The exception occurs trying to load all SequenceItems (hibDAOmssql.LoadAll<RORC_datagrid.Poco.SequenceItem>();), mapped like below. So anyone has an idea of what's happening here?
Code:
public class SequenceItem
{
#region Properties
double sequenceitemid;
public virtual double Sequenceitemid
{
get { return sequenceitemid; }
set { sequenceitemid = value; }
}
double sequenceid;
public virtual double Sequenceid
{
get { return sequenceid; }
set { sequenceid = value; }
}
string itemname;
public virtual string Itemname
{
get { return itemname; }
set { itemname = value; }
}
#endregion
public override string ToString()
{
return this.Itemname;
}
public override bool Equals(object obj)
{
if (obj == null)
return false;
SequenceItem other = obj as SequenceItem;
if (other == null)
return false;
return (this.Sequenceid == other.Sequenceid && this.Sequenceitemid == other.Sequenceitemid);
}
public override int GetHashCode()
{
int hash = 13;
hash += this.Itemname == null ? 0 : this.Itemname.GetHashCode();
return hash;
}
}
Quote:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="RORC_datagrid.Poco.SequenceItem, RORC_datagrid" table="V_SEQUENCEITEMS">
<composite-id>
<key-property name="Sequenceitemid" column="SequenceItemID"/>
<key-property name="Sequenceid" column="SequenceID"/>
</composite-id>
<property name="Itemname" column="ItemName"/>
</class>
</hibernate-mapping>