hibernate - How to auto increment data on new record insertion -
i add user defined column auto increment on new record insertion, how should this? runs on h2, mysql
@entity public class parent { @onetomany list<child> children; } @entity public class child { int sortorder; } e.g. parent1 has child{1, 2, 3} parent2 has {1, 2}
note: values within each parent needs auto incremented not outside.
set id type identity, , db tbale should handle identity insertion.
sample,
<id name="daytypeid" column="day_type_id" type="int"> <generator class="identity"> </generator> </id>
Comments
Post a Comment