Package org.hibernate.ogm.datastore.couchdb.dialect.model.impl

Examples of org.hibernate.ogm.datastore.couchdb.dialect.model.impl.CouchDBTupleSnapshot


    return new Tuple( new CouchDBTupleSnapshot( key ) );
  }

  @Override
  public void updateTuple(Tuple tuple, EntityKey key, TupleContext tupleContext) {
    CouchDBTupleSnapshot snapshot = (CouchDBTupleSnapshot) tuple.getSnapshot();

    String revision = (String) snapshot.get( Document.REVISION_FIELD_NAME );

    // load the latest revision for updates without the revision being present; a warning about
    // this mapping will have been issued at factory start-up
    if ( revision == null && !snapshot.isCreatedOnInsert() ) {
      revision = getDataStore().getCurrentRevision( Identifier.createEntityId( key ), false );
    }

    // this will raise an optimistic locking exception if the revision is either null or not the current one
    getDataStore().saveDocument( new EntityDocument( key, revision, tuple ) );
View Full Code Here

TOP

Related Classes of org.hibernate.ogm.datastore.couchdb.dialect.model.impl.CouchDBTupleSnapshot

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.