Java UpdateQuery Example

说明

java updatequery示例是从最受好评的开源项目中提取的实现代码,你可以参考下面示例的使用方式。

编程语言: Java

类/类型: UpdateQuery

示例#1
文件: HibernateDatabase.java项目: nperrier/music-server

 public <T> T update(UpdateQuery<T> query) throws DBException {
   try {
     query.setDb(this);
     Session session = this.beginTransaction();
     T result = query.query(session);
     this.commit();
     return result;
   } catch (DBException e) {
     this.rollback();
     throw e;
   } catch (Exception e) {
     this.rollback();
     throw new DBException("Update Error: ", e);
   } finally {
     this.endTransaction();
   }
 }

示例#2
文件: UpdateExtendQuery.java项目: justinhjq/KukiThirdLibs

 @Override
 public UpdateExtendQuery<T> where(String[] whereArgs, String[] argValues) {
   super.where(whereArgs, argValues);
   return this;
 }

示例#3
文件: UpdateExtendQuery.java项目: justinhjq/KukiThirdLibs

 @Override
 public UpdateExtendQuery<T> where(String whereClause) {
   super.where(whereClause);
   return this;
 }

示例#4
文件: ElasticsearchTemplate.java项目: JinGeek/spring-data-elasticsearch

 @Override
 public UpdateResponse update(UpdateQuery query) {
   String indexName =
       isNotBlank(query.getIndexName())
           ? query.getIndexName()
           : getPersistentEntityFor(query.getClazz()).getIndexName();
   String type =
       isNotBlank(query.getType())
           ? query.getType()
           : getPersistentEntityFor(query.getClazz()).getIndexType();
   Assert.notNull(indexName, "No index defined for Query");
   Assert.notNull(type, "No type define for Query");
   Assert.notNull(query.getId(), "No Id define for Query");
   Assert.notNull(query.getIndexRequest(), "No IndexRequest define for Query");
   UpdateRequestBuilder updateRequestBuilder =
       client.prepareUpdate(indexName, type, query.getId());
   if (query.DoUpsert()) {
     updateRequestBuilder
         .setDocAsUpsert(true)
         .setUpsert(query.getIndexRequest())
         .setDoc(query.getIndexRequest());
   } else {
     updateRequestBuilder.setDoc(query.getIndexRequest());
   }
   return updateRequestBuilder.execute().actionGet();
 }

示例#5
文件: RunCassandraCommand.java项目: tpinho/Easy-Cassandra

 /**
  * update on object from cassandra by key.
  *
  * @param key the key
  * @param bean the bean
  * @return the update
  */
 public Update runUpdate(Object key, Class<?> bean) {
   return updateQuery.runUpdate(key, bean);
 }

展开阅读全文