Tabnine Logo
Versioning.getVersion
Code IndexAdd Tabnine to your IDE (free)

How to use
getVersion
method
in
org.hibernate.engine.internal.Versioning

Best Java code snippets using org.hibernate.engine.internal.Versioning.getVersion (Showing top 20 results out of 315)

origin: hibernate/hibernate-orm

/**
 * Perform an SQL INSERT, and then retrieve a generated identifier.
 * <p/>
 * This form is used for PostInsertIdentifierGenerator-style ids (IDENTITY,
 * select, etc).
 */
protected Serializable insert(
    final Object[] fields,
    final boolean[] notNull,
    String sql,
    final Object object,
    final SharedSessionContractImplementor session) throws HibernateException {
  if ( LOG.isTraceEnabled() ) {
    LOG.tracev( "Inserting entity: {0} (native id)", getEntityName() );
    if ( isVersioned() ) {
      LOG.tracev( "Version: {0}", Versioning.getVersion( fields, this ) );
    }
  }
  Binder binder = new Binder() {
    public void bindValues(PreparedStatement ps) throws SQLException {
      dehydrate( null, fields, notNull, propertyColumnInsertable, 0, ps, session, false );
    }
    public Object getEntity() {
      return object;
    }
  };
  return identityDelegate.performInsert( sql, session, binder );
}
origin: hibernate/hibernate-orm

private AbstractEntityInsertAction addInsertAction(
    Object[] values,
    Serializable id,
    Object entity,
    EntityPersister persister,
    boolean useIdentityColumn,
    EventSource source,
    boolean shouldDelayIdentityInserts) {
  if ( useIdentityColumn ) {
    EntityIdentityInsertAction insert = new EntityIdentityInsertAction(
        values, entity, persister, isVersionIncrementDisabled(), source, shouldDelayIdentityInserts
    );
    source.getActionQueue().addAction( insert );
    return insert;
  }
  else {
    Object version = Versioning.getVersion( values, persister );
    EntityInsertAction insert = new EntityInsertAction(
        id, values, entity, version, persister, isVersionIncrementDisabled(), source
    );
    source.getActionQueue().addAction( insert );
    return insert;
  }
}
origin: hibernate/hibernate-orm

  final LockMode lockMode,
  final SharedSessionContractImplementor session) {
final Object version = Versioning.getVersion( values, persister );
session.getPersistenceContext().addEntry(
    object,
origin: hibernate/hibernate-orm

/**
 * Make the entity "managed" by the persistence context.
 */
public final void makeEntityManaged() {
  nullifyTransientReferencesIfNotAlready();
  final Object version = Versioning.getVersion( getState(), getPersister() );
  getSession().getPersistenceContext().addEntity(
      getInstance(),
      ( getPersister().isMutable() ? Status.MANAGED : Status.READ_ONLY ),
      getState(),
      getEntityKey(),
      version,
      LockMode.WRITE,
      isExecuted,
      getPersister(),
      isVersionIncrementDisabled
  );
}
origin: hibernate/hibernate-orm

/**
 * Convenience method to retrieve an entities next version value
 */
private Object getNextVersion(FlushEntityEvent event) throws HibernateException {
  EntityEntry entry = event.getEntityEntry();
  EntityPersister persister = entry.getPersister();
  if ( persister.isVersioned() ) {
    Object[] values = event.getPropertyValues();
    if ( entry.isBeingReplicated() ) {
      return Versioning.getVersion( values, persister );
    }
    else {
      int[] dirtyProperties = event.getDirtyProperties();
      final boolean isVersionIncrementRequired = isVersionIncrementRequired(
          event,
          entry,
          persister,
          dirtyProperties
      );
      final Object nextVersion = isVersionIncrementRequired ?
          Versioning.increment( entry.getVersion(), persister.getVersionType(), event.getSession() ) :
          entry.getVersion(); //use the current version
      Versioning.setVersion( values, nextVersion, persister );
      return nextVersion;
    }
  }
  else {
    return null;
  }
}
origin: hibernate/hibernate-orm

    source
);
Object version = Versioning.getVersion( values, persister );
origin: hibernate/hibernate-orm

  );
version = Versioning.getVersion( values, subclassPersister );
LOG.tracef( "Cached Version : %s", version );
origin: hibernate/hibernate-orm

persister.processInsertGeneratedProperties( id, instance, getState(), session );
if ( persister.isVersionPropertyGenerated() ) {
  version = Versioning.getVersion( getState(), persister );
origin: hibernate/hibernate-orm

nextVersion = Versioning.getVersion( state, persister );
origin: hibernate/hibernate-orm

final Object version = Versioning.getVersion( hydratedState, persister );
final CacheEntry entry = persister.buildCacheEntry( entity, hydratedState, version, session );
final EntityDataAccess cache = persister.getCacheAccessStrategy();
origin: hibernate/hibernate-orm

protected interface InclusionChecker {
  boolean includeProperty(int propertyNumber);
}
origin: org.hibernate/com.springsource.org.hibernate

/**
 * Perform an SQL INSERT, and then retrieve a generated identifier.
 * <p/>
 * This form is used for PostInsertIdentifierGenerator-style ids (IDENTITY,
 * select, etc).
 */
protected Serializable insert(
    final Object[] fields,
    final boolean[] notNull,
    String sql,
    final Object object,
    final SessionImplementor session) throws HibernateException {
  if ( LOG.isTraceEnabled() ) {
    LOG.tracev( "Inserting entity: {0} (native id)", getEntityName() );
    if ( isVersioned() ) {
      LOG.tracev( "Version: {0}", Versioning.getVersion( fields, this ) );
    }
  }
  Binder binder = new Binder() {
    public void bindValues(PreparedStatement ps) throws SQLException {
      dehydrate( null, fields, notNull, propertyColumnInsertable, 0, ps, session );
    }
    public Object getEntity() {
      return object;
    }
  };
  return identityDelegate.performInsert( sql, session, binder );
}
origin: org.hibernate/com.springsource.org.hibernate

private AbstractEntityInsertAction addInsertAction(
    Object[] values,
    Serializable id,
    Object entity,
    EntityPersister persister,
    boolean useIdentityColumn,
    EventSource source,
    boolean shouldDelayIdentityInserts) {
  if ( useIdentityColumn ) {
    EntityIdentityInsertAction insert = new EntityIdentityInsertAction(
        values, entity, persister, isVersionIncrementDisabled(), source, shouldDelayIdentityInserts
    );
    source.getActionQueue().addAction( insert );
    return insert;
  }
  else {
    Object version = Versioning.getVersion( values, persister );
    EntityInsertAction insert = new EntityInsertAction(
        id, values, entity, version, persister, isVersionIncrementDisabled(), source
    );
    source.getActionQueue().addAction( insert );
    return insert;
  }
}
origin: org.hibernate/com.springsource.org.hibernate.core

private AbstractEntityInsertAction addInsertAction(
    Object[] values,
    Serializable id,
    Object entity,
    EntityPersister persister,
    boolean useIdentityColumn,
    EventSource source,
    boolean shouldDelayIdentityInserts) {
  if ( useIdentityColumn ) {
    EntityIdentityInsertAction insert = new EntityIdentityInsertAction(
        values, entity, persister, isVersionIncrementDisabled(), source, shouldDelayIdentityInserts
    );
    source.getActionQueue().addAction( insert );
    return insert;
  }
  else {
    Object version = Versioning.getVersion( values, persister );
    EntityInsertAction insert = new EntityInsertAction(
        id, values, entity, version, persister, isVersionIncrementDisabled(), source
    );
    source.getActionQueue().addAction( insert );
    return insert;
  }
}
origin: org.hibernate.orm/hibernate-core

private AbstractEntityInsertAction addInsertAction(
    Object[] values,
    Object id,
    Object entity,
    EntityTypeDescriptor descriptor,
    boolean useIdentityColumn,
    EventSource source,
    boolean shouldDelayIdentityInserts) {
  if ( useIdentityColumn ) {
    EntityIdentityInsertAction insert = new EntityIdentityInsertAction(
        values, entity, descriptor, isVersionIncrementDisabled(), source, shouldDelayIdentityInserts
    );
    source.getActionQueue().addAction( insert );
    return insert;
  }
  else {
    Object version = Versioning.getVersion( values, descriptor );
    EntityInsertAction insert = new EntityInsertAction(
        id, values, entity, version, descriptor, isVersionIncrementDisabled(), source
    );
    source.getActionQueue().addAction( insert );
    return insert;
  }
}
origin: org.hibernate/com.springsource.org.hibernate

/**
 * Make the entity "managed" by the persistence context.
 */
public final void makeEntityManaged() {
  nullifyTransientReferencesIfNotAlready();
  Object version = Versioning.getVersion( getState(), getPersister() );
  getSession().getPersistenceContext().addEntity(
      getInstance(),
      ( getPersister().isMutable() ? Status.MANAGED : Status.READ_ONLY ),
      getState(),
      getEntityKey(),
      version,
      LockMode.WRITE,
      isExecuted,
      getPersister(),
      isVersionIncrementDisabled,
      false
  );
}
origin: org.hibernate/com.springsource.org.hibernate.core

/**
 * Make the entity "managed" by the persistence context.
 */
public final void makeEntityManaged() {
  nullifyTransientReferencesIfNotAlready();
  Object version = Versioning.getVersion( getState(), getPersister() );
  getSession().getPersistenceContext().addEntity(
      getInstance(),
      ( getPersister().isMutable() ? Status.MANAGED : Status.READ_ONLY ),
      getState(),
      getEntityKey(),
      version,
      LockMode.WRITE,
      isExecuted,
      getPersister(),
      isVersionIncrementDisabled,
      false
  );
}
origin: org.hibernate.orm/hibernate-core

/**
 * Make the entity "managed" by the persistence context.
 */
public final void makeEntityManaged() {
  nullifyTransientReferencesIfNotAlready();
  final Object version = Versioning.getVersion( getState(), getEntityDescriptor() );
  getSession().getPersistenceContext().addEntity(
      getInstance(),
      ( getEntityDescriptor().getHierarchy().getMutabilityPlan().isMutable() ? Status.MANAGED : Status.READ_ONLY ),
      getState(),
      getEntityKey(),
      version,
      LockMode.WRITE,
      isExecuted,
      getEntityDescriptor(),
      isVersionIncrementDisabled
  );
}
origin: org.hibernate/com.springsource.org.hibernate

protected static interface InclusionChecker {
  public boolean includeProperty(int propertyNumber);
}
origin: org.hibernate/com.springsource.org.hibernate.core

protected static interface InclusionChecker {
  public boolean includeProperty(int propertyNumber);
}
org.hibernate.engine.internalVersioninggetVersion

Javadoc

Extract the optimistic locking value out of the entity state snapshot.

Popular methods of Versioning

  • increment
    Generate the next increment in the optimistic locking value according the VersionType contract for t
  • isVersionIncrementRequired
    Do we need to increment the version number, given the dirty properties?
  • seed
    Create an initial optimistic locking value according the VersionTypecontract for the version propert
  • seedVersion
    Create an initial optimistic locking value according the VersionSupportcontract for the version prop
  • setVersion
    Inject the optimistic locking value into the entity state snapshot.

Popular in Java

  • Making http requests using okhttp
  • scheduleAtFixedRate (Timer)
  • setContentView (Activity)
  • compareTo (BigDecimal)
  • BufferedInputStream (java.io)
    A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the i
  • PrintWriter (java.io)
    Wraps either an existing OutputStream or an existing Writerand provides convenience methods for prin
  • Proxy (java.net)
    This class represents proxy server settings. A created instance of Proxy stores a type and an addres
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • DecimalFormat (java.text)
    A concrete subclass of NumberFormat that formats decimal numbers. It has a variety of features desig
  • Manifest (java.util.jar)
    The Manifest class is used to obtain attribute information for a JarFile and its entries.
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now