IStatelessSession inserts a many-to-one object

I have a general mapping

<class name="NotSyncPrice, Portal.Core" table='Not_sync_price'>
<id name="Id" unsaved-value="0">
  <column name="id" not-null="true"/>
  <generator class="native"/>
</id>
<many-to-one name="City" class="Clients.Core.Domains.City, Clients.Core" column="city_id"
             cascade="none"></many-to-one>
<!--<property name="City">
  <column name="city_id"/>
</property>-->

I want to use IStatelessSession for batch insertion. But when I set the city object to the NotSyncPrice object and called IStatelessSession, I got a strange exception:

NHibernate.Impl.StatelessSessionImpl.get_Timestamp()

When its null or int value is ok. I am trying to use a real && proxy city. But there is no result. What's wrong :( Please help

+3
source share
2 answers

This may be due to the cacheable attribute. If you flagged this object or request for loading criteria that should be cached, it cannot be downloaded using a session without saving.

+2

.

, <cache>.

-. - .

, . .

. hibernate, :

<property name="cache.use_second_level_cache">false</property>

, <cache> .

+2

Source: https://habr.com/ru/post/1749142/


All Articles