javax.persistence.SequenceGenerator Java Examples

The following examples show how to use javax.persistence.SequenceGenerator. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: User.java    From Cerberus with MIT License 5 votes vote down vote up
@Id
@Column(name = "id")
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "users_seq")
@SequenceGenerator(name = "users_seq", sequenceName = "users_seq", allocationSize = 1)
 public Long getId() {
   return this.id;
 }
 
Example #2
Source File: JPAOverriddenAnnotationReader.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
private Annotation getSequenceGenerator(List<Element> elementsForProperty, XMLContext.Default defaults) {
	for ( Element element : elementsForProperty ) {
		Element subelement = element != null ? element.element( annotationToXml.get( SequenceGenerator.class ) ) : null;
		if ( subelement != null ) {
			return buildSequenceGeneratorAnnotation( subelement );
		}
	}
	if ( elementsForProperty.size() == 0 && defaults.canUseJavaAnnotations() ) {
		return getPhysicalAnnotation( SequenceGenerator.class );
	}
	else {
		return null;
	}
}
 
Example #3
Source File: JPAOverriddenAnnotationReader.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
private SequenceGenerator getSequenceGenerator(Element tree, XMLContext.Default defaults) {
	Element element = tree != null ? tree.element( annotationToXml.get( SequenceGenerator.class ) ) : null;
	if ( element != null ) {
		return buildSequenceGeneratorAnnotation( element );
	}
	else if ( defaults.canUseJavaAnnotations() ) {
		return getPhysicalAnnotation( SequenceGenerator.class );
	}
	else {
		return null;
	}
}
 
Example #4
Source File: JPAOverriddenAnnotationReader.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public static SequenceGenerator buildSequenceGeneratorAnnotation(Element element) {
	if ( element != null ) {
		AnnotationDescriptor ad = new AnnotationDescriptor( SequenceGenerator.class );
		copyStringAttribute( ad, element, "name", false );
		copyStringAttribute( ad, element, "sequence-name", false );
		copyIntegerAttribute( ad, element, "initial-value" );
		copyIntegerAttribute( ad, element, "allocation-size" );
		return AnnotationFactory.create( ad );
	}
	else {
		return null;
	}
}
 
Example #5
Source File: IdGeneratorInterpreterImpl.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void interpretSequenceGenerator(
		SequenceGenerator sequenceGeneratorAnnotation,
		IdentifierGeneratorDefinition.Builder definitionBuilder) {
	fallbackInterpreter.interpretSequenceGenerator( sequenceGeneratorAnnotation, definitionBuilder );

	if ( delegates != null ) {
		for ( IdGeneratorStrategyInterpreter delegate : delegates ) {
			delegate.interpretSequenceGenerator( sequenceGeneratorAnnotation, definitionBuilder );
		}
	}
}
 
Example #6
Source File: IdGeneratorInterpreterImpl.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
@SuppressWarnings("deprecation")
public void interpretSequenceGenerator(
		SequenceGenerator sequenceGeneratorAnnotation,
		IdentifierGeneratorDefinition.Builder definitionBuilder) {
	definitionBuilder.setName( sequenceGeneratorAnnotation.name() );

	definitionBuilder.setStrategy( "seqhilo" );

	if ( !BinderHelper.isEmptyAnnotationValue( sequenceGeneratorAnnotation.sequenceName() ) ) {
		definitionBuilder.addParam( org.hibernate.id.SequenceGenerator.SEQUENCE, sequenceGeneratorAnnotation.sequenceName() );
	}
	//FIXME: work on initialValue() through SequenceGenerator.PARAMETERS
	//		steve : or just use o.h.id.enhanced.SequenceStyleGenerator
	if ( sequenceGeneratorAnnotation.initialValue() != 1 ) {
		log.unsupportedInitialValue( AvailableSettings.USE_NEW_ID_GENERATOR_MAPPINGS );
	}
	definitionBuilder.addParam( SequenceHiLoGenerator.MAX_LO, String.valueOf( sequenceGeneratorAnnotation.allocationSize() - 1 ) );
}
 
Example #7
Source File: IdGeneratorInterpreterImpl.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void interpretSequenceGenerator(
		SequenceGenerator sequenceGeneratorAnnotation,
		IdentifierGeneratorDefinition.Builder definitionBuilder) {
	definitionBuilder.setName( sequenceGeneratorAnnotation.name() );
	definitionBuilder.setStrategy( SequenceStyleGenerator.class.getName() );

	if ( !BinderHelper.isEmptyAnnotationValue( sequenceGeneratorAnnotation.catalog() ) ) {
		definitionBuilder.addParam(
				PersistentIdentifierGenerator.CATALOG,
				sequenceGeneratorAnnotation.catalog()
		);
	}
	if ( !BinderHelper.isEmptyAnnotationValue( sequenceGeneratorAnnotation.schema() ) ) {
		definitionBuilder.addParam(
				PersistentIdentifierGenerator.SCHEMA,
				sequenceGeneratorAnnotation.schema()
		);
	}
	if ( !BinderHelper.isEmptyAnnotationValue( sequenceGeneratorAnnotation.sequenceName() ) ) {
		definitionBuilder.addParam(
				SequenceStyleGenerator.SEQUENCE_PARAM,
				sequenceGeneratorAnnotation.sequenceName()
		);
	}

	definitionBuilder.addParam(
			SequenceStyleGenerator.INCREMENT_PARAM,
			String.valueOf( sequenceGeneratorAnnotation.allocationSize() )
	);
	definitionBuilder.addParam(
			SequenceStyleGenerator.INITIAL_PARAM,
			String.valueOf( sequenceGeneratorAnnotation.initialValue() )
	);
}
 
Example #8
Source File: OracleLongEntity.java    From tianti with Apache License 2.0 5 votes vote down vote up
@Id
@SequenceGenerator(name = "ID_SEQ")
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "ID_SEQ")
@Column(name = "ID", nullable = false)
public Long getId() {
	return id;
}
 
Example #9
Source File: Album.java    From PhotoAlbum-api with MIT License 5 votes vote down vote up
@Id
@Column(name = "id")
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "albums_seq")
@SequenceGenerator(name = "albums_seq", sequenceName = "albums_seq", allocationSize = 1)
public Long getId() {
	return this.id;
}
 
Example #10
Source File: Photo.java    From PhotoAlbum-api with MIT License 5 votes vote down vote up
@Id
@Column(name = "id")
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "photos_seq")
@SequenceGenerator(name = "photos_seq", sequenceName = "photos_seq", allocationSize = 1)
public Long getId() {
	return this.id;
}
 
Example #11
Source File: File.java    From PhotoAlbum-api with MIT License 5 votes vote down vote up
@Id
@Column(name = "id")
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "files_seq")
@SequenceGenerator(name = "files_seq", sequenceName = "files_seq", allocationSize = 1)
public Long getId() {
	return this.id;
}
 
Example #12
Source File: Student.java    From sample-java-spring-genericdao with Apache License 2.0 5 votes vote down vote up
@Id
@Column(name = "STUDENT_ID", unique = true, nullable = false)
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_STUDENT_ID")
@SequenceGenerator(name = "SEQ_STUDENT_ID", sequenceName = "SEQ_STUDENT_ID", allocationSize=1, initialValue=1)
//@org.hibernate.annotations.GenericGenerator(name="SEQ_STUDENT_ID", strategy = "sequence",  parameters = { @org.hibernate.annotations.Parameter(name="sequence", value="SEQ_STUDENT_ID") } )	
public Integer getId() {
	return this.id;
}
 
Example #13
Source File: Instructor.java    From sample-java-spring-genericdao with Apache License 2.0 5 votes vote down vote up
@Id
@Column(name = "INSTRUCTOR_ID", unique = true, nullable = false)
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_INSTRUCTOR_ID")
@SequenceGenerator(name = "SEQ_INSTRUCTOR_ID", sequenceName = "SEQ_INSTRUCTOR_ID", allocationSize=1, initialValue=1)
public Integer getId() {
	return this.id;
}
 
Example #14
Source File: Classes.java    From sample-java-spring-genericdao with Apache License 2.0 5 votes vote down vote up
@Id
@Column(name = "CLASSES_ID", unique = true, nullable = false)
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_CLASSES_ID")
@SequenceGenerator(name = "SEQ_CLASSES_ID", sequenceName = "SEQ_CLASSES_ID", allocationSize=1, initialValue=1)
public Integer getId() {
	return this.id;
}
 
Example #15
Source File: SCCRepository.java    From uyuni with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Gets the id.
 * @return the id
 */
@Id
@Column(name = "id")
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sccrepository_seq")
@SequenceGenerator(name = "sccrepository_seq", sequenceName = "suse_sccrepository_id_seq",
                   allocationSize = 1)
public Long getId() {
    return id;
}
 
Example #16
Source File: JobData.java    From scheduling with GNU Affero General Public License v3.0 5 votes vote down vote up
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "JOBID_SEQUENCE")
@SequenceGenerator(name = "JOBID_SEQUENCE", sequenceName = "JOBID_SEQUENCE", allocationSize = 1, initialValue = 1)
@Column(name = "ID")
public Long getId() {
    return id;
}
 
Example #17
Source File: AuthzAuditEventDbObj.java    From ranger with Apache License 2.0 5 votes vote down vote up
@Id
@SequenceGenerator(name="XA_ACCESS_AUDIT_SEQ",sequenceName="XA_ACCESS_AUDIT_SEQ",allocationSize=1)
@GeneratedValue(strategy=GenerationType.AUTO,generator="XA_ACCESS_AUDIT_SEQ")
@Column(name = "id", unique = true, nullable = false)
public long getAuditId() {
	return this.auditId;
}
 
Example #18
Source File: CreditCardStagingData.java    From kfs with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Gets the id attribute.
 *
 * @return Returns the id.
 */
@Id
@GeneratedValue(generator = "TEM_CREDIT_CARD_STAGING_ID_SEQ")
@SequenceGenerator(name = "TEM_CREDIT_CARD_STAGING_ID_SEQ", sequenceName = "TEM_CREDIT_CARD_STAGING_ID_SEQ", allocationSize = 5)
@Column(name = "ID", nullable = false)
public Integer getId() {
    return id;
}
 
Example #19
Source File: TripAccountingInformation.java    From kfs with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Gets the id attribute.
 * @return Returns the id.
 */
@Id
@GeneratedValue(generator = "TEM_TRP_ACCT_INFO_ID_SEQ")
@SequenceGenerator(name = "TEM_TRP_ACCT_INFO_ID_SEQ", sequenceName = "TEM_TRP_ACCT_INFO_ID_SEQ", allocationSize = 5)
@Column(name="ID",nullable=false)
public Integer getId() {
    return id;
}
 
Example #20
Source File: AgencyStagingData.java    From kfs with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Gets the id attribute.
 * @return Returns the id.
 */
@Id
@GeneratedValue(generator = "TEM_AGENCY_STAGING_ID_SEQ")
@SequenceGenerator(name = "TEM_AGENCY_STAGING_ID_SEQ", sequenceName = "TEM_AGENCY_STAGING_ID_SEQ", allocationSize = 5)
@Column(name = "ID", nullable = false)
public Integer getId() {
    return id;
}
 
Example #21
Source File: AccountingDocumentRelationship.java    From kfs with GNU Affero General Public License v3.0 5 votes vote down vote up
@Id
@GeneratedValue(generator = "TEM_ACCT_DOC_REL_ID_SEQ")
@SequenceGenerator(name = "TEM_ACCT_DOC_REL_ID_SEQ", sequenceName = "TEM_ACCT_DOC_REL_ID_SEQ", allocationSize = 5)
@Column(name = ID, length = 19, nullable = false)
public Integer getId() {
    return id;
}
 
Example #22
Source File: BaseTemProfile.java    From kfs with GNU Affero General Public License v3.0 5 votes vote down vote up
@Id
@GeneratedValue(generator = "TEM_TRAVELER_DTL_ID_SEQ")
@SequenceGenerator(name = "TEM_TRAVELER_DTL_ID_SEQ", sequenceName = "TEM_TRAVELER_DTL_ID_SEQ", allocationSize = 5)
@Column(name = "id", nullable = false)
public Integer getId() {
    return id;
}
 
Example #23
Source File: TemProfileArranger.java    From kfs with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Gets the arrangerId attribute.
 * @return Returns the arrangerId.
 */
@Id
@GeneratedValue(generator = "TEM_PROFILE_ARRANGER_ID_SEQ")
@SequenceGenerator(name = "TEM_PROFILE_ARRANGER_ID_SEQ", sequenceName = "TEM_PROFILE_ARRANGER_ID_SEQ", allocationSize = 5)
@Column(name = "arranger_id", nullable = false)
public Integer getArrangerId() {
    return arrangerId;
}
 
Example #24
Source File: TemProfile.java    From kfs with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Gets the profileId attribute.
 *
 * @return Returns the profileId.
 */
@Id
@GeneratedValue(generator = "TEM_PROFILE_ID_SEQ")
@SequenceGenerator(name = "TEM_PROFILE_ID_SEQ", sequenceName = "TEM_PROFILE_ID_SEQ", allocationSize = 5)
@Column(name = "profile_id", nullable = false, length = 19)
public Integer getProfileId() {
    return profileId;
}
 
Example #25
Source File: MileageRate.java    From kfs with GNU Affero General Public License v3.0 5 votes vote down vote up
@Id
@GeneratedValue(generator="TEM_MILEAGE_RT_ID_SEQ")
@SequenceGenerator(name="TEM_MILEAGE_RT_ID_SEQ",sequenceName="TEM_MILEAGE_RT_ID_SEQ", allocationSize=5)
@Column(name="id",nullable=false)
public Integer getId() {
    return id;
}
 
Example #26
Source File: GroupTraveler.java    From kfs with GNU Affero General Public License v3.0 5 votes vote down vote up
@Id
@GeneratedValue(generator="TEM_GRP_TRVLR_ID_SEQ")
@SequenceGenerator(name="TEM_GRP_TRVLR_ID_SEQ",sequenceName="TEM_GRP_TRVLR_ID_SEQ", allocationSize=5)
@Column(name="id",nullable=false)
public Integer getId() {
    return id;
}
 
Example #27
Source File: PerDiem.java    From kfs with GNU Affero General Public License v3.0 5 votes vote down vote up
@Id
@GeneratedValue(generator="TEM_PER_DIEM_ID_SEQ")
@SequenceGenerator(name="TEM_PER_DIEM_ID_SEQ",sequenceName="TEM_PER_DIEM_ID_SEQ", allocationSize=5)
@Column(name="id",nullable=false)
public Integer getId() {
    return id;
}
 
Example #28
Source File: ImageStore.java    From uyuni with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @return the id
 */
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "imgstore_seq")
@SequenceGenerator(name = "imgstore_seq", sequenceName = "suse_imgstore_id_seq",
                   allocationSize = 1)
public Long getId() {
    return id;
}
 
Example #29
Source File: ProjectSource.java    From uyuni with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Gets the id.
 *
 * @return id
 */
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "content_prj_src_seq")
@SequenceGenerator(name = "content_prj_src_seq", sequenceName = "suse_ct_prj_src_seq", allocationSize = 1)
public Long getId() {
    return id;
}
 
Example #30
Source File: EnvironmentTarget.java    From uyuni with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Gets the id.
 *
 * @return id
 */
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "content_prj_env_target_seq")
@SequenceGenerator(name = "content_prj_env_target_seq", sequenceName = "suse_ct_env_tgt_seq", allocationSize = 1)
public Long getId() {
    return id;
}