Ok, some time have now passed and the question on this topic have evolved.
I do not manage to create a successful query against my db.
DB created as follows.
CREATE TABLE People(
id int identity(1,1) NOT NULL PRIMARY KEY,
resellerName nvarchar(100)NOT NULL,
phone nvarchar(100) NOT NULL,
address nvarchar(100) NOT NULL,
city nvarchar(100) NOT NULL,
country nvarchar(100) DEFAULT 'Sverige' NOT NULL,
updateTimestamp datetime DEFAULT current_timestamp NOT NULL)
GO
The mapping file is as follows
%?xml version="1.0" encoding="utf-8" ?%
%hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"%
%class name="icenet.Modules.ListResellers.Domain.Reseller, icenet.Modules.ListResellers"
table="People"%
%id name="Id" column="id" type="Int32" unsaved-value="-1"%
%generator class="identity" /%
%/id%
%property name="Name" column="resellerName" type="String" length="100" not-null="true" /%
%property name="Phone" column="phone" type="String" length="100" not-null="true" /%
%property name="Address" column="address" type="String" length="100" not-null="true" /%
%property name="City" column="city" type="String" length="100" not-null="true" /%
%property name="Country" column="country" type="String" length="100" not-null="true" /%
%timestamp name="UpdateTimestamp" column="updateTimestamp" unsave-value="1/1/0001" /%
%/class%
%/hibernate-mapping%
And into this I just want to begin by doing simple retrievals. Though I do not get to that stage bug get the following error.
[QueryException: in expected: %end-of-text% (possibly an invalid or unmapped class name was used in the query) [from Reseller]]
NHibernate.Hql.Classic.FromParser.End(QueryTranslator q) +84
NHibernate.Hql.Classic.ClauseParser.EndChild(QueryTranslator q) +34
NHibernate.Hql.Classic.ClauseParser.End(QueryTranslator q) +50
NHibernate.Hql.Classic.PreprocessingParser.End(QueryTranslator q) +44
NHibernate.Hql.Classic.ParserHelper.Parse(IParser p, String text, String seperators, QueryTranslator q) +232
NHibernate.Hql.Classic.QueryTranslator.Compile() +126
NHibernate.Hql.Classic.QueryTranslator.Compile(IDictionary replacements, Boolean scalar) +54
NHibernate.Impl.SessionFactoryImpl.GetQuery(String queryString, Boolean shallow, IDictionary enabledFilters) +135
NHibernate.Impl.SessionImpl.GetQueries(String query, Boolean scalar) +34
NHibernate.Impl.SessionImpl.Find(String query, QueryParameters parameters, IList results) +132
NHibernate.Impl.SessionImpl.Find(String query, QueryParameters parameters) +42
NHibernate.Impl.QueryImpl.List() +105
icenet.Modules.ListResellers.ListResellersModule.getAllResellers() +66
[Exception: KABOOOOM!!!!
Err: Reseller Listing]
icenet.Modules.ListResellers.ListResellersModule.getAllResellers() +153
icenet.Modules.ListResellers.Web.ListResellers.DoMagic_Click(Object sender, EventArgs e) +47
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565
I have the Reseller.hbm.xml file as an embedded resource, which appears to be a common issue when this error message is tossed.
Error with mapping of the class... Mapping how, when, why?
Or is it something with how the call is made for the DB?
public IList getAllResellers()
{
ISession session = this._sessionManager.OpenSession();
string hql = "from Reseller";
IQuery q = session.CreateQuery(hql);
try
{
return q.List();
}
catch (Exception X)
{
throw new Exception("KABOOOOM!!!!\n Err: " + base.Section.Title, X);
}
}
Any clues from anyone. Like always, all help is appreciated.