When inserting an entity that references an entity with assigned id causes
exception if that entity as a cache property.
Example:
<class name="Document" >
<cache region="ShortTerm" usage="read-write" />
<id name="Name" >
<generator class="assigned"/>
</id>
<property name="Text"/>
</class>
<class name="Paper">
<id name="Id">
<generator class="native"/>
</id>
<property name="Color"/>
<many-to-one name="Document" column="DocId" cascade="none" />
</class>
When inserting a Paper entity using BatchInsert in the stateless session
throws Not Supported exception from the Timestamp property on the session (
ISessionImplementor).
This happens in the end of the IsTransient method (of the
AbstractEntityPersister):
// check to see if it is in the second-level cache
if (HasCache)
{
CacheKey ck = new CacheKey(id, IdentifierType, RootEntityName, session.
EntityMode, session.Factory);
if (Cache.Get(ck, session.Timestamp) != null)
return false;
}
I am unsure of the best way to solve the problem. Is there a clean way to
check if the session is stateless? That is change the above if statement to
something like if(HasCache && !session.IsStateless), doesn't feel like a
nice way to handle this though.
Using NHibernate 4.1.0.4000 on net452.
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.