@GeneratedValue的strategy

1, GenerationType.SEQUENCE: hibernate_sequence table by generating a call to record the current maximum primary key value, which can be compatible with Oracle, but all of the primary key table are generated from only one of the sequences. If the maximum value of the table is reset, the newly-generated key may conflict.

2, GenerationType.IDENTITY: primary key for each table are only on the respective accumulated maximum key values, each table complementary interference. It can be used for mysql, but is not compatible with the oracle, because it does not support table's primary key increment.

Guess you like

Origin www.cnblogs.com/StarkBrothers/p/11769058.html