Class CounterGeneration

java.lang.Object
ch.tocco.nice2.businessunit.impl.counter.CounterGeneration
All Implemented Interfaces:
Serializable, org.hibernate.generator.AnnotationBasedGenerator<Counter>, org.hibernate.generator.BeforeExecutionGenerator, org.hibernate.generator.Generator

public class CounterGeneration extends Object implements org.hibernate.generator.BeforeExecutionGenerator, org.hibernate.generator.AnnotationBasedGenerator<Counter>
Creates counters based on 'Counter' table for fields of type 'counter'.
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Controls whether a generated counter field may be manually changed on events which do not trigger value generation (i.e.
    generate(org.hibernate.engine.spi.SharedSessionContractImplementor session, Object owner, Object currentValue, org.hibernate.generator.EventType eventType)
     
    EnumSet<org.hibernate.generator.EventType>
     
    void
    initialize(Counter annotation, org.hibernate.generator.GeneratorCreationContext generatorCreationContext)
     

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.hibernate.generator.AnnotationBasedGenerator

    initialize

    Methods inherited from interface org.hibernate.generator.BeforeExecutionGenerator

    generatedOnExecution

    Methods inherited from interface org.hibernate.generator.Generator

    allowAssignedIdentifiers, generatedBeforeExecution, generatedOnExecution, generatesOnForceIncrement, generatesOnInsert, generatesOnUpdate, generatesSometimes, getGeneratedType
  • Field Details

  • Constructor Details

    • CounterGeneration

      public CounterGeneration()
  • Method Details

    • initialize

      public void initialize(Counter annotation, org.hibernate.generator.GeneratorCreationContext generatorCreationContext)
      Specified by:
      initialize in interface org.hibernate.generator.AnnotationBasedGenerator<Counter>
    • getEventTypes

      public EnumSet<org.hibernate.generator.EventType> getEventTypes()
      Specified by:
      getEventTypes in interface org.hibernate.generator.Generator
    • allowMutation

      public boolean allowMutation()
      Controls whether a generated counter field may be manually changed on events which do not trigger value generation (i.e. updates, since counters are only generated on EventType.INSERT). Some customers manually edit counter values. In such a case `nice2.businessunit.counterAllowMutation` must be set to true.
      Specified by:
      allowMutation in interface org.hibernate.generator.Generator
    • generate

      public Object generate(org.hibernate.engine.spi.SharedSessionContractImplementor session, Object owner, Object currentValue, org.hibernate.generator.EventType eventType)
      Specified by:
      generate in interface org.hibernate.generator.BeforeExecutionGenerator