Search in sources :

Example 11 with IdentifierGeneratorDefinition

use of org.hibernate.boot.model.IdentifierGeneratorDefinition in project hibernate-orm by hibernate.

the class AnnotationBinder method buildLocalGenerators.

private static HashMap<String, IdentifierGeneratorDefinition> buildLocalGenerators(XAnnotatedElement annElt, MetadataBuildingContext context) {
    HashMap<String, IdentifierGeneratorDefinition> generators = new HashMap<String, IdentifierGeneratorDefinition>();
    TableGenerator tabGen = annElt.getAnnotation(TableGenerator.class);
    SequenceGenerator seqGen = annElt.getAnnotation(SequenceGenerator.class);
    GenericGenerator genGen = annElt.getAnnotation(GenericGenerator.class);
    if (tabGen != null) {
        IdentifierGeneratorDefinition idGen = buildIdGenerator(tabGen, context);
        generators.put(idGen.getName(), idGen);
    }
    if (seqGen != null) {
        IdentifierGeneratorDefinition idGen = buildIdGenerator(seqGen, context);
        generators.put(idGen.getName(), idGen);
    }
    if (genGen != null) {
        IdentifierGeneratorDefinition idGen = buildIdGenerator(genGen, context);
        generators.put(idGen.getName(), idGen);
    }
    return generators;
}
Also used : HashMap(java.util.HashMap) SequenceGenerator(javax.persistence.SequenceGenerator) IdentifierGeneratorDefinition(org.hibernate.boot.model.IdentifierGeneratorDefinition) TableGenerator(javax.persistence.TableGenerator) GenericGenerator(org.hibernate.annotations.GenericGenerator)

Aggregations

IdentifierGeneratorDefinition (org.hibernate.boot.model.IdentifierGeneratorDefinition)11 HashMap (java.util.HashMap)5 AnnotationException (org.hibernate.AnnotationException)5 EmbeddedId (javax.persistence.EmbeddedId)3 SequenceGenerator (javax.persistence.SequenceGenerator)3 XClass (org.hibernate.annotations.common.reflection.XClass)3 XProperty (org.hibernate.annotations.common.reflection.XProperty)3 ArrayList (java.util.ArrayList)2 Properties (java.util.Properties)2 GeneratedValue (javax.persistence.GeneratedValue)2 Id (javax.persistence.Id)2 JoinTable (javax.persistence.JoinTable)2 ManyToOne (javax.persistence.ManyToOne)2 MappedSuperclass (javax.persistence.MappedSuperclass)2 MapsId (javax.persistence.MapsId)2 OneToOne (javax.persistence.OneToOne)2 PrimaryKeyJoinColumn (javax.persistence.PrimaryKeyJoinColumn)2 PrimaryKeyJoinColumns (javax.persistence.PrimaryKeyJoinColumns)2 TableGenerator (javax.persistence.TableGenerator)2 GenericGenerator (org.hibernate.annotations.GenericGenerator)2