I use Hibernate 4 and Oracle 11g. And there is a convenient feature in this duet. I can neatly point out as follows:
@Entity
@Table(name = "APPLICATION", schema = "PRODUCTION")
public class ApplicationVersionModel {
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "PRODUCTION.SEQUENCE_NEW")
@SequenceGenerator(name = "PRODUCTION.SEQUENCE_NEW", schema = "PRODUCTION", sequenceName = "PRODUCTION.SEQUENCE_NEW", allocationSize = 1)
@Column(name = "ID")
@XmlTransient
@Getter @Setter private Long id;
And describe the sequence in the DB:
CREATED 27.02.17
LAST_DDL_TIME 27.02.17
SEQUENCE_OWNER PRODUCTION
SEQUENCE_NAME SEQUENCE_NEW
MIN_VALUE 1
MAX_VALUE 9999999999999999999999999999
INCREMENT_BY 1
CYCLE_FLAG N
ORDER_FLAG N
CACHE_SIZE 20
LAST_NUMBER 957101
PARTITION_COUNT
SESSION_FLAG N
KEEP_VALUE N
So that the combination will allow me to use the app in a multithread environment. And simultaneously accessing users will get a unique id with no threat to a collision. The documentation explicitly declares this feature.
In that sence, is there any similar functionality in pair of Hibernate and Mysql? Any suggestion is highly appreciated. Many thanks in advance.