乱七八糟-今天看了一会儿NHibernate,调试记录一下

I learn NHibernate 2.1 for a while this morning, meet some trouble with save a one to many relation to sql server.

 

1. find NHibernate 2.1 force you to config a procy factory property in hibernate config file, you can choose Castle, LinFu, or Sprint.net as proxy. the default castle dependencies has been removed. I have to add follow tag in config as I using castle as proxy:

     <property name="proxyfactory.factory_class">

        NHibernate.ByteCode.Castle.ProxyFactoryFactory,

        NHibernate.ByteCode.Castle

      </property>

and I frustrate quite a while to find the NHibernate.ByteCode.Castle.dll from google, finally find it in Nhibernate 2.1 package. faint…..

 

2.find when the one-to-many relation the saving always failed when transation commit. And find out the parent mapping config file, in bag(or set, or else) tag the columns name should be “child table” column name!! which let me feel so strange. Previously I was roughly consider it should be parent table column’s name, sicene it is in parent mapping config file.

 

3.find when the one to many save to database, if not use inverse=’true’ in parent mapping config, it will generate 3 types of sql: insert parent, insert child, and update child…. But actually update the child relation is not needed. And some article is describe this issue, link.

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值