Hi all,
For my datamodel I'm trying to use HiLo or Guid.Comb to generate my
Id's but I seem to overlook something. When I use native or identity
as the generator class objects are stored to the database, when using
HiLo or Guid.Comb no roundtrip towards the database is done.
I have read the various articles on how the generation works, but
still I don't seem to get the objects stored.
I use the following (for the sake of te example simplified) code:
[Class(NameType = typeof(Person))]
public class Person
{
private Guid _id;
[Cache(-3, Usage = CacheUsage.ReadWrite)]
[Id(-2, Name = "Id")]
[Generator(-1, Class = "guid.comb")]
public virtual Guid Id {
get
{
return _id;
} set
{
_id = value;
} }
[Property]
public virtual string Name { get; set; }
}
And the following dao to store the object:
public class MyDao : HibernateDaoSupport, IMyDao
{
public void SaveOrUpdate(Person person)
{
var t = Session.BeginTransaction();
Session.SaveOrUpdate(person);
t.Commit();
}
}
When I use NHibernate Profiler I can see the Begin and Commit of the
transaction when using Guid.Comb but no trace of the person being
stored. Switching to native and identity does show the INSERT Query.
Does someone know what causes this behavior, and a way to resolve this
problem?
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en.