|
@ -4,6 +4,7 @@ package com.fjordtek.bookstore.model.auth; |
|
|
|
|
|
|
|
|
import javax.persistence.EntityManager; |
|
|
import javax.persistence.EntityManager; |
|
|
import javax.persistence.PersistenceContext; |
|
|
import javax.persistence.PersistenceContext; |
|
|
|
|
|
import javax.persistence.Query; |
|
|
import javax.persistence.TypedQuery; |
|
|
import javax.persistence.TypedQuery; |
|
|
|
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
@ -45,4 +46,17 @@ public class UserRoleRepositoryImpl implements UserRoleRepositoryCustom { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public void deleteByCompositeId(Long userId, Long roleId) { |
|
|
|
|
|
|
|
|
|
|
|
Query query = entityManager.createQuery( |
|
|
|
|
|
"DELETE FROM UserRole" + |
|
|
|
|
|
" WHERE user_id = :user_id" + |
|
|
|
|
|
" AND role_id = :role_id" |
|
|
|
|
|
); |
|
|
|
|
|
query.setParameter("user_id", userId); |
|
|
|
|
|
query.setParameter("role_id", roleId); |
|
|
|
|
|
query.executeUpdate(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |