NHibernate ignoriert die hbm.xml-Dateien
Ich habe eine neue Tabelle hinzugefügt,.hbm.xml
Datei undclass
zu bestehender Anwendung. Auf der Seite werden auch Daten aus anderen Tabellen angezeigt.
Für diese neue Tabelle werden keine Daten gespeichert und angezeigt.
NHibernate
ignoriert es. Ich bekomme keine Fehlermeldung. Ich ändere auch dietable
Wert im neuenhbm.xml
Datei, aber es liegt kein Fehler vor. Aber wenn ich mich änderetable
In anderen Dateien löst die Anwendung eine Ausnahme aus. Sieht so aus, als ob die neue Datei nicht bekannt ist. Ich habe diese Datei als erstelltEmbedded Resource
. Ich benutzeVS 2010
, MVC
undOracle
undC#
Und hier ist die XML und Klasse. Danke im Voraus.
<?xml version="1.0" encoding="utf-8" ?>
<class name="CaseMgr.Model.BusinessObjects.PatLiverPeld, CaseMgr.Model" table="TGLN.PAT_LIVER_PELD" lazy="true">
<id name="Id" column="PLP_ID" unsaved-value="0">
<generator class="sequence">
<param name="sequence">PLP_SEQ</param>
</generator>
</id>
<timestamp name="ModifyDate" column="MODIFY_DATE" generated="always"></timestamp>
<property name="CreateDate" column="CREATE_DATE" update="false"></property>
<property name="CreateBy" column="CREATE_BY" update="false" />
<property name="ModifyBy" column="MODIFY_BY" update="false" />
<property name="TestDate" column="PELD_TEST_DATE" />
<property name="ExpDate" column="PELD_EXP_DATE" />
<property name="SerumBilirubin" column="SERUM_BILIRUBIN" />
<property name="Inr" column="INR" />
<property name="Albumin" column="ALBUMIN" />
<property name="GrowthFailure" column="GROWTH_FAILURE" type="YesNo" />
<property name="Peld" column="PELD" />
<many-to-one name="PatRegister" column="PATR_ID" class="PatRegister" />
<bag name="PatLiverSmcs" lazy="true" inverse="true" >
<key column="PATR_ID"></key>
<one-to-many class="PatLiverSmc"></one-to-many>
</bag>
<bag name="PatLiverSmcHiss" lazy="true" cascade="all-delete-orphan" inverse="true" >
<key column="PATR_ID"></key>
<one-to-many class="PatLiverSmcHis"></one-to-many>
</bag>
public partial class PatLiverPeld : BusinessBase<decimal>
{
private DateTime _createDate = new DateTime();
private string _createBy =string.Empty;
private string _modifyBy = string.Empty;
private DateTime _modifyDate = new DateTime();
private DateTime? _testDate ;
private DateTime? _expDate ;
private double? _serumBilirubin ;
private double? _inr ;
private double? _albumin ;
private bool _growthFailure ;
private double? _peld ;
private PatRegister _patRegister = null;
private IList<PatLiverSmc> _patLiverSmcs = new List<PatLiverSmc>();
private IList<PatLiverSmcHis> _patLiverSmcHiss = new List<PatLiverSmcHis>();
public PatLiverPeld(){ }
public override int GetHashCode()
{
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append(this.GetType().FullName);
sb.Append(_createDate);
sb.Append(_createBy);
sb.Append(_modifyBy);
sb.Append(_modifyDate);
sb.Append(_testDate);
sb.Append(_expDate);
sb.Append(_serumBilirubin);
sb.Append(_inr);
sb.Append(_albumin);
sb.Append(_growthFailure);
sb.Append(_peld);
return sb.ToString().GetHashCode();
}
public virtual DateTime CreateDate
{
get { return _createDate; }
set { _createDate = value; }
}
public virtual string CreateBy
{
get { return _createBy; }
set { _createBy = value; }
}
public virtual string ModifyBy
{
get { return _modifyBy; }
set { _modifyBy = value; }
}
public virtual DateTime ModifyDate
{
get { return _modifyDate; }
set { _modifyDate = value; }
}
public virtual DateTime? TestDate
{
get { return _testDate; }
set { _testDate = value; }
}
public virtual DateTime? ExpDate
{
get { return _expDate; }
set { _expDate = value; }
}
public virtual double? SerumBilirubin
{
get { return _serumBilirubin; }
set { _serumBilirubin = value; }
}
public virtual double? Inr
{
get { return _inr; }
set { _inr = value; }
}
public virtual double? Albumin
{
get { return _albumin; }
set { _albumin = value; }
}
public virtual bool GrowthFailure
{
get { return _growthFailure; }
set { _growthFailure = value; }
}
public virtual double? Peld
{
get { return _peld; }
set { _peld = value; }
}
public virtual PatRegister PatRegister
{
get { return _patRegister; }
set { _patRegister = value; }
}
public virtual IList<PatLiverSmc> PatLiverSmcs
{
get { return _patLiverSmcs; }
set { _patLiverSmcs = value; }
}
public virtual IList<PatLiverSmcHis> PatLiverSmcHiss
{
get { return _patLiverSmcHiss; }
set { _patLiverSmcHiss = value; }
}
public virtual bool IsDataExpired
{
get
{
return (ExpDate.HasValue && ExpDate.Value <= DateTime.Today);
}
}
//public virtual bool IsPatPeld
//{
// get { return this.PatRegister.Pat.Age <= LiverSmcConst.PAEDIATRIC_PELD_AGE; }
//}
}
Web.Config
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory>
<property name="connection.provider">CaseMgr.Web.Dao.SvcConnectionProvider,CaseMgr.Web</property>
<!--<property name="connection.provider">CaseMgr.Model.Base.NHConnectionProvider, CaseMgr.Model</property>-->
<property name="connection.driver_class">NHibernate.Driver.OracleDataClientDriver</property>
<property name="connection.connection_string_name">OraConnStr</property>
<property name="show_sql">false</property>
<property name="dialect">NHibernate.Dialect.Oracle9iDialect</property>
<property name="hbm2ddl.keywords">none</property>
<property name="query.substitutions">true 'Y', false 'N'</property>
<property name="proxyfactory.factory_class">NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu</property>
<property name="cache.provider_class">CaseMgr.OracleCache.OraCacheProvider, CaseMgr.OracleCache</property>
<property name="cache.use_second_level_cache">true</property>
<property name="cache.use_query_cache">true</property>
<mapping assembly="CaseMgr.Model" />
</session-factory>
</hibernate-configuration>