Hi all,
I am currently working on NHibernate 1.2 for my Project.
I was able to save my transaction using save(caseObject) for Single Entity.If i try the same for entity collection save(caseObjectCollectionb), I am unable to achieve it.
The reason behind targeting this bulk insert, is to minimise the hit to the database.By getting support to bulk insert(say 5 or 15 records) the number of hits to the database is reduced to 1 rather than depending on the number of records.
Here with I have provided samples.
Normal Save Entity:
public virtual Result Save(Case objCase)
{
try
{
this.OpenSession();
this.BeginTransaction();
session.Save(objCase);
this.CommitTransaction();
return new Result(true);
}
catch (Exception ex)
{
return new Result(false,ApplicationManager.StackExceptionMessages(ex),ex);
}
finally
{
}
}
Saving an EntityCollection:
public virtual Result Save(CaseCollection objCaseCollection)
{
try
{
this.OpenSession();
this.BeginTransaction();
session.Save((IList)objCaseCollection);
this.CommitTransaction();
return new Result(true);
}
catch (Exception ex)
{
this.RollbackTransaction();
return new Result(false, ApplicationManager.StackExceptionMessages(ex), ex);
}
finally
{
}
}
When i try to save this EntityCollection, I am getting this ERROR
"Unknown Entity Class".
Please give me your thoughts, what i am missing or wrong.
Let me know any further clarification needed.
Thanks
Cheers
Sudhagar.S
|