|
@@ -4,6 +4,7 @@ import com.keao.edu.im.pojo.UserInfo;
|
|
|
import org.springframework.data.jpa.repository.JpaRepository;
|
|
|
import org.springframework.data.jpa.repository.Lock;
|
|
|
import org.springframework.data.jpa.repository.Modifying;
|
|
|
+import org.springframework.data.jpa.repository.Query;
|
|
|
import org.springframework.stereotype.Repository;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
@@ -15,7 +16,7 @@ import javax.persistence.LockModeType;
|
|
|
@Repository
|
|
|
public interface UserDao extends JpaRepository<UserInfo, Long> {
|
|
|
|
|
|
- @Lock(LockModeType.PESSIMISTIC_WRITE)
|
|
|
+ @Query(value = "SELECT * FROM rongyun_user WHERE uid = ?1 FOR UPDATE", nativeQuery = true)
|
|
|
UserInfo lockFindByUid(String uid);
|
|
|
|
|
|
UserInfo findByUid(String uid);
|