views:

65

answers:

2

hi, I have one field in my table and values for that field willbe generated by the sequence which i have given in hbm mapping. now my question is, if i provide value for these field which has mapped with sequence , what will happen? 1. will hibernate ignore the value provided by me and it invoke its sequence? or 2. will it take the value given by me( i am expectiong invoking sequence will not happen)?

+1  A: 

It will be an error- either you tell NH that the number is autogenerated, or you give NH the number. it can't be both.

Dani
A: 

In most cases there should not be need to modify such column directly - for example 'version' managed by Hibernate.

Petteri Hietavirta