h...@all,
i solved this problem. It was only a configuration problem. I compared
with the spring.net example hibernate project and found my errors.

Thanks for reading.

Regards

eigeneachse

On Dec 1, 4:38 pm, eigeneachse <[email protected]> wrote:
> h...@all,
> i am using nhibernate with spring.net. I tried to implement the
> transactional behavior as described 
> herehttp://www.springframework.net/docs/1.1-RC2/reference/html/orm.html
> but it wont work for me. I really dont know what i am doing wrong.
> Here is my config.
> <!-- Database and NHibernate Configuration -->
>   <db:provider id="DbProvider"
>                provider="OracleClient-2.0"
>                connectionString="Data Source=(DESCRIPTION =
> (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = ${db.host})(PORT = $
> {db.port})))(CONNECT_DATA = (SERVICE_NAME = ${db.database})));User Id=$
> {db.user};Password=${db.password};"
>   />
>
>   <object id="HibernateTransactionManager"
> type="Spring.Data.NHibernate.HibernateTransactionManager,
> Spring.Data.NHibernate20">
>     <property name="DbProvider" ref="DbProvider"/>
>     <property name="SessionFactory" ref="NHibernateSessionFactory"/>
>     <property name="NestedTransactionsAllowed" value="true" />
>   </object>
>
>   <object id="AutoProxyCreator"
> type="Spring.Aop.Framework.AutoProxy.DefaultAdvisorAutoProxyCreator,
> Spring.Aop" autowire="byName"></object>
>   <object id="TransactionAdvisor"
> type="Spring.Transaction.Interceptor.TransactionAttributeSourceAdvisor,
> Spring.Data" autowire="constructor"></object>
>
>   <!-- Transaction Interceptor -->
>   <object id="TransactionInterceptor"
> type="Spring.Transaction.Interceptor.TransactionInterceptor,
> Spring.Data">
>     <property name="TransactionManager"
> ref="HibernateTransactionManager"/>
>     <property name="TransactionAttributeSource"
> ref="AttributeTransactionAttributeSource"/>
>   </object>
>   <object id="AttributeTransactionAttributeSource"
> type="Spring.Transaction.Interceptor.AttributesTransactionAttributeSource,
> Spring.Data"></object>
>
>   <tx:attribute-driven transaction-
> manager="HibernateTransactionManager"/>
>
>   <object id="HibernateTemplate"
> type="Spring.Data.NHibernate.Generic.HibernateTemplate">
>     <property name="SessionFactory" ref="NHibernateSessionFactory" />
>     <property name="TemplateFlushMode" value="Auto" />
>     <property name="CacheQueries" value="true" />
>   </object>
>
>   <!--End Hibernate Config-->
>
> I have decorated my Service Mehthod as follows.
> [Transaction(TransactionPropagation.Required, ReadOnly=false)]
>         public virtual DTOXy AMethod(Int64 anId, AnObject dto){
> ...
> transactionDao.Save(object1);
> transactionDao.Save(object2);
>
> }
>
> When i look inside my log then i see that there is a new session
> created for every statement. What am i doing wrong?
>
> Here an excerpt from my log.
>
> DEBUG Spring.Data.NHibernate.HibernateAccessor - Eagerly flushing
> Hibernate session
> DEBUG NHibernate.Event.Default.AbstractFlushingEventListener -
> flushing session
> DEBUG NHibernate.Event.Default.AbstractFlushingEventListener -
> processing flush-time cascades
> DEBUG NHibernate.Event.Default.AbstractFlushingEventListener - dirty
> checking collections
> DEBUG NHibernate.Event.Default.AbstractFlushingEventListener -
> Flushing entities and processing referenced collections
> DEBUG NHibernate.Event.Default.AbstractFlushingEventListener -
> Processing unreferenced collections
> DEBUG NHibernate.Event.Default.AbstractFlushingEventListener -
> Scheduling collection removes/(re)creates/updates
> DEBUG NHibernate.Event.Default.AbstractFlushingEventListener -
> Flushed: 1 insertions, 0 updates, 0 deletions to 1 objects
> DEBUG NHibernate.Event.Default.AbstractFlushingEventListener -
> Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
> DEBUG NHibernate.Impl.Printer - listing entities:
> DEBUG NHibernate.Impl.Printer - Objects.Entities.Common.MyEntity
> {MandatorId=123456789}
> DEBUG NHibernate.Event.Default.AbstractFlushingEventListener -
> executing flush
> DEBUG NHibernate.AdoNet.ConnectionManager - registering flush begin
> DEBUG NHibernate.Caches.SysCache2.SysCacheRegion - root cache item for
> region not found.
> DEBUG NHibernate.Caches.SysCache2.SysCacheRegion - Creating root cache
> entry for cache region: UpdateTimestampsCache
> DEBUG NHibernate.Caches.SysCache2.SysCacheRegion - adding new data:
> key=NHibernate-Cache:UpdateTimestampsCache:my_ent...@1670209579 &
> value=5159663062421504
> DEBUG NHibernate.Caches.SysCache2.SysCacheRegion - item will expire
> at: 12/01/2009 16:06:44
> DEBUG NHibernate.Persister.Entity.AbstractEntityPersister - Inserting
> entity: [Objects.Entities.Common.MyEntity#123456789]
> DEBUG NHibernate.AdoNet.AbstractBatcher - Opened new IDbCommand, open
> IDbCommands: 1
> DEBUG NHibernate.AdoNet.AbstractBatcher - Building an IDbCommand
> object for the SqlString: INSERT INTO MY_ENTITY (MANDATOR_ID) VALUES
> (?)
> DEBUG NHibernate.Persister.Entity.AbstractEntityPersister -
> Dehydrating entity: [Objects.Entities.Common.MyEntity#123456789]
> DEBUG NHibernate.Type.Int64Type - binding '123456789' to parameter: 0
> DEBUG NHibernate.SQL - INSERT INTO MY_ENTITY (MANDATOR_ID) VALUES
> (:p0); :p0 = '123456789'
> NHibernate: INSERT INTO MY_ENTITY (MANDATOR_ID) VALUES (:p0); :p0 =
> '123456789'
> DEBUG NHibernate.Connection.DriverConnectionProvider - Obtaining
> IDbConnection from Driver
> DEBUG NHibernate.AdoNet.AbstractBatcher - Closed IDbCommand, open
> IDbCommands: 0
> DEBUG NHibernate.AdoNet.ConnectionManager - skipping aggressive-
> release due to flush cycle
> DEBUG NHibernate.AdoNet.ConnectionManager - registering flush end
> DEBUG NHibernate.AdoNet.ConnectionManager - aggressively releasing
> database connection
> DEBUG NHibernate.Connection.ConnectionProvider - Closing connection
> DEBUG NHibernate.Event.Default.AbstractFlushingEventListener - post
> flush
> DEBUG Spring.Data.NHibernate.SessionFactoryUtils - Closing Hibernate
> Session
> DEBUG NHibernate.Impl.SessionImpl - closing session
>
> I know this is not an spring.net group but i really hope you can help
> me.
>
> Please help me.
>
> Regards
>
> eigeneachse

--

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.


Reply via email to