Skip to content

Instantly share code, notes, and snippets.

@RELATO
Created May 18, 2016 11:42
Show Gist options
  • Save RELATO/f4123ff59df866b25a12a0a317aaf22f to your computer and use it in GitHub Desktop.
Save RELATO/f4123ff59df866b25a12a0a317aaf22f to your computer and use it in GitHub Desktop.
#tips: http://www.programcreek.com/java-api-examples/index.php?api=org.hibernate.annotations.Parameter
package com.supportmycode.model;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.GenerationType;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;
@Entity(name = "hilo")
public class Hilo {
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "hilo_sequence_generator")
@GenericGenerator(
name = "hilo_sequence_generator",
strategy = "org.hibernate.id.enhanced.SequenceStyleGenerator",
parameters = {
@Parameter(name = "sequence_name", value = "hilo_seq"),
@Parameter(name = "value_column", value = "next_value"),
@Parameter(name = "initial_value", value = "1"),
@Parameter(name = "increment_size", value = "1"),
@Parameter(name = "optimizer", value = "hilo")
})
@Id
private Long id;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment