开发者

Nhibernate, sequence and version problems

I have the following situation on my oracle db:

开发者_StackOverflow社区

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?


Implement an IInterceptor, or if you want to do it the dirty way: update those columns in a trigger and map your fields as Generated="Always" (or Insert)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜