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

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -