Close

Sequence generation in JPA

@Entity@Table(name = “Facility”)public class FacilityEntity implements Serializable{ private static final long serialVersionUID = -5193920209461702399L; @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = “SEQ_FACILITY_ID”) @SequenceGenerator(name = “SEQ_FACILITY_ID”, sequenceName=”SEQ_FACILITY_ID”) @Column(name=”facilityid”) private Long facilityId;.. } It took me some time to figure this out, you have to have sequenceName in your SequenceGenrator annotation. It might work without it, and might…