简体   繁体   中英

Nhibernate, sequence and version problems

I have the following situation on my oracle db:

When a new record need to be insert, the pk field is generated by sequence, and thats working fine.

I got another field, lets call him A, not the pk, that needs to get his value from another sequence, I also got another column that needs to get the same value as the A field got, on some cases, and on other cases not.

Another field I got called B is defined as a version column, on some cases I need to copy this value to another field.

All of this logic is simple to implement, but I wanna know how can I do all this stuff on a single insert command where is the best place to intercept the insert command, whats recommended on this special cases?

实现IInterceptor,或者如果您想用肮脏的方式实现它:更新触发器中的这些列,并将字段映射为Generated =“ Always”(或Insert)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM