当前位置: 首页>>代码示例>>Java>>正文


Java Modifying类代码示例

本文整理汇总了Java中org.springframework.data.jpa.repository.Modifying的典型用法代码示例。如果您正苦于以下问题:Java Modifying类的具体用法?Java Modifying怎么用?Java Modifying使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Modifying类属于org.springframework.data.jpa.repository包,在下文中一共展示了Modifying类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: deleteBelongingTo

import org.springframework.data.jpa.repository.Modifying; //导入依赖的package包/类
/**
   * Delete all messages that do not involve users other than the one specified (no other users as sender o recipient)
   * @param userProfile the receiver/sender of the message
   */
  @Modifying
  @Transactional(readOnly = false) 
  public void deleteBelongingTo(YadaUserProfile userProfile) {
  	// Messages that have the user as sender or recipient, and nobody else involved, or
  	// where the user is both sender and recipient
  	List <YadaUserMessage> toDelete = YadaSql.instance().selectFrom("select yum from YadaUserMessage yum")
  	    .where("(sender=:userProfile and recipient=null)").or()
  	    .where("(sender=null and recipient=:userProfile)").or()
  	    .where("(sender=:userProfile and recipient=:userProfile)")
   	.setParameter("userProfile", userProfile)
   	.query(em, YadaUserMessage.class).getResultList();
  	// Need to fetch them all then delete them, in order to cascade deletes to "created" and "attachment"
  	for (YadaUserMessage yadaUserMessage : toDelete) {
	em.remove(yadaUserMessage);
}
  }
 
开发者ID:xtianus,项目名称:yadaframework,代码行数:21,代码来源:YadaUserMessageDao.java

示例2: updateCounts

import org.springframework.data.jpa.repository.Modifying; //导入依赖的package包/类
/**
 * Updates counts of test run.
 * @param id Test run id.
 * @param totalCases Total test case count.
 * @param failedCases Total failed test cases count.
 */
@Modifying
@Transactional
@Query("UPDATE TestRun tr SET tr.exampleCount = COALESCE(tr.exampleCount, 0) + :totalCases, " +
		"tr.failureCount = COALESCE(tr.failureCount, 0) + :failedCases, " +
		"tr.duration = COALESCE(tr.duration, 0) + :duration " +
		"WHERE tr.id = :id")
void updateCounts(@Param("id")  Long id, @Param("totalCases") int totalCases, @Param("failedCases") int failedCases,
				  @Param("duration") double duration);
 
开发者ID:ATLANTBH,项目名称:owl,代码行数:15,代码来源:TestRunRepository.java

示例3: updateStaffProfile

import org.springframework.data.jpa.repository.Modifying; //导入依赖的package包/类
@Modifying
@Query(QueryProperties.updateStaffProfileByEmpId)
int updateStaffProfile(@Param("employeeFirstName") String employeeFirstName,
                       @Param("employeeLastName") String employeeLastName,
                       @Param("employeeTitle") String employeeTitle,
                       @Param("employeePhone") String employeePhone,
                       @Param("employeeId") long employeeId);
 
开发者ID:Mahidharmullapudi,项目名称:timesheet-upload,代码行数:8,代码来源:EmployeeRepository.java

示例4: addTicket

import org.springframework.data.jpa.repository.Modifying; //导入依赖的package包/类
/**
 * Opens a new ticket
 * @param type
 * @param title
 * @param messageText initial ticket message
 * @param sender User opening the ticket
 * @param severity
 * @return the newly created ticket
 */
   @Modifying
   @Transactional(readOnly = false) 
   public YadaTicket addTicket(YadaLocalEnum<?> type, String title, String messageText, YadaUserProfile sender, int severity) {
   	List<YadaTicketMessage> yadaTicketMessages = new ArrayList<>();
	YadaTicket yadaTicket = new YadaTicket();
	yadaTicket.setStatus(YadaTicketStatus.OPEN);
	yadaTicket.setPriority(severity);
	yadaTicket.setType(type);
	yadaTicket.setOwner(sender);
	yadaTicket.setTitle(title);

	YadaTicketMessage yadaTicketMessage = new YadaTicketMessage();	
	yadaTicketMessage.setTitle(title);
	yadaTicketMessage.setMessage(messageText);
	yadaTicketMessage.setSender(sender);
	// When a ticket is added, no recipient has been chosen yet for the message
	// yadaTicketMessage.setRecipient();
	yadaTicketMessage.setStackable(false); // Same-content messages will never be stacked
	yadaTicketMessage.setPriority(severity); // message priority is the same as ticket priority

	yadaTicket.setMessages(yadaTicketMessages);
	yadaTicketMessage.setYadaTicket(yadaTicket);
	yadaTicketMessages.add(yadaTicketMessage);
	
	em.persist(yadaTicket); // Cascade save
	return yadaTicket;
}
 
开发者ID:xtianus,项目名称:yadaframework,代码行数:37,代码来源:YadaTicketDao.java

示例5: replyTicket

import org.springframework.data.jpa.repository.Modifying; //导入依赖的package包/类
/**
   * Send a reply to a ticket.
   * @param yadaTicket
   * @param messageText
   * @param replySender the user replying to the previous message, could be either the support staff or the original user
   * @param supportStaffReply true if this reply is an answer to the user who opened the ticket, false if it is the user answer to the support staff
   * @param closeTicket true if the replyer has closed the ticket on this reply
   * @return the new message added to the ticket
   */
  @Modifying
  @Transactional(readOnly = false) 
  public YadaTicketMessage replyTicket(Long yadaTicketId, String messageText, YadaUserProfile replySender, boolean supportStaffReply, boolean closeTicket) {
  	YadaTicket yadaTicket = em.find(YadaTicket.class, yadaTicketId); 
  	// Altrimenti si prende "could not initialize proxy - no Session" alla getMessages()
YadaTicketMessage yadaTicketMessage = new YadaTicketMessage();	
yadaTicket.getMessages().add(yadaTicketMessage);
yadaTicketMessage.setYadaTicket(yadaTicket);
yadaTicketMessage.setMessage(messageText);
yadaTicketMessage.setTitle(yadaTicket.getTitle());
yadaTicketMessage.setSender(replySender);
if (supportStaffReply) {
	yadaTicketMessage.setRecipient(yadaTicket.getOwner());
} else {
	yadaTicketMessage.setRecipient(yadaTicket.getAssigned()); // Could be null, but it's ok
}
yadaTicketMessage.setStackable(false); // Same-content messages will never be stacked
yadaTicketMessage.setPriority(yadaTicket.getPriority()); // message priority is the same as ticket priority
if (closeTicket) {
	yadaTicket.setStatus(YadaTicketStatus.CLOSED);
} else {
	// When the owner replies without closing, the ticket becomes OPEN
	// When the staff replies an open ticket, the status becomes ANSWERED
	yadaTicket.setStatus(supportStaffReply && yadaTicket.isOpen() ? YadaTicketStatus.ANSWERED : YadaTicketStatus.OPEN);
}
return yadaTicketMessage;
  }
 
开发者ID:xtianus,项目名称:yadaframework,代码行数:37,代码来源:YadaTicketDao.java

示例6: deleteExpired

import org.springframework.data.jpa.repository.Modifying; //导入依赖的package包/类
@Modifying
   @Transactional(readOnly = false)
@Query("delete from #{#entityName} e where e.expiration is not null and e.expiration < NOW()")
void deleteExpired();
 
开发者ID:xtianus,项目名称:yadaframework,代码行数:5,代码来源:YadaAutoLoginTokenRepository.java

示例7: deleteOlderThan

import org.springframework.data.jpa.repository.Modifying; //导入依赖的package包/类
@Modifying
@Transactional
@Query("delete from BotCamera bc where bc.timeTaken < ?1")
void deleteOlderThan(Date timeTaken);
 
开发者ID:corydissinger,项目名称:mtgo-best-bot,代码行数:5,代码来源:BotCameraRepository.java

示例8: deleteUserById

import org.springframework.data.jpa.repository.Modifying; //导入依赖的package包/类
@Modifying
@Query(value = "delete from user where id = ?", nativeQuery = true)
public void deleteUserById(String id);
 
开发者ID:SnailFastGo,项目名称:springboot_op,代码行数:4,代码来源:UserEntityRepository.java

示例9: updateByIsRead

import org.springframework.data.jpa.repository.Modifying; //导入依赖的package包/类
@Modifying
@Query("update Notification n set n.isRead = true where n.touser = ?1")
void updateByIsRead(User user);
 
开发者ID:ChinaLHR,项目名称:JavaQuarkBBS,代码行数:4,代码来源:NotificationDao.java

示例10: deleteArticleCateLabel

import org.springframework.data.jpa.repository.Modifying; //导入依赖的package包/类
@Modifying(clearAutomatically = true)
@Transactional
@Query(nativeQuery = true, value = "DELETE FROM ARTICLE_CATE_LABEL WHERE ARTICLE_ID=:articleId")
int deleteArticleCateLabel(@Param("articleId") Long articleId);
 
开发者ID:handexing,项目名称:pinkyLam-Blog-Server,代码行数:5,代码来源:ArticleCateLabelDao.java

示例11: updateStatus

import org.springframework.data.jpa.repository.Modifying; //导入依赖的package包/类
@Modifying(clearAutomatically = true)
@Transactional
@Query(nativeQuery = true, value = "UPDATE MEMO_REMIND SET STATUS=:status WHERE ID =:id")
int updateStatus(@Param("id") Long id, @Param("status") Integer status);
 
开发者ID:handexing,项目名称:pinkyLam-Blog-Server,代码行数:5,代码来源:MemoRemindDao.java

示例12: deleteByBoTypeId

import org.springframework.data.jpa.repository.Modifying; //导入依赖的package包/类
@Modifying
@Transactional
@Query(value="DELETE FROM cms_page WHERE bo_type_id = :boTypeId", nativeQuery=true)
void deleteByBoTypeId(@Param(value="boTypeId") long boTypeId);
 
开发者ID:bndynet,项目名称:web-framework-for-java,代码行数:5,代码来源:PageRepository.java

示例13: batchDelete

import org.springframework.data.jpa.repository.Modifying; //导入依赖的package包/类
@Modifying
@Query("delete from InstanceConfig  where ConfigAppId=?1 and ConfigClusterName=?2 and ConfigNamespaceName = ?3")
int batchDelete(String appId, String clusterName, String namespaceName);
 
开发者ID:dewey-its,项目名称:apollo-custom,代码行数:4,代码来源:InstanceConfigRepository.java

示例14: deleteByYadaUserCredentialsAndType

import org.springframework.data.jpa.repository.Modifying; //导入依赖的package包/类
@Modifying
   @Transactional(readOnly = false)
@Query("delete from #{#entityName} e where e.yadaUserCredentials = :userCredentials and e.type = :facebookType")
void deleteByYadaUserCredentialsAndType(@Param("userCredentials") YadaUserCredentials userCredentials, @Param("facebookType") int facebookType);
 
开发者ID:xtianus,项目名称:yadaframework,代码行数:5,代码来源:YadaSocialCredentialsRepository.java

示例15: seletctJvmByTomcatId

import org.springframework.data.jpa.repository.Modifying; //导入依赖的package包/类
@Modifying
@Query("select p.time,p.psJVM from TomcatResultEntity p where p.tomcatId=(?1) order by p.time asc ")
List<TomcatResultEntity> seletctJvmByTomcatId(String id);
 
开发者ID:Martion2017,项目名称:ApplicationDetection,代码行数:4,代码来源:ResultTomcatRepository.java


注:本文中的org.springframework.data.jpa.repository.Modifying类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。