@Transactional
public Integer removeAuthor(Book book){
final Book b = book;
Integer k = template.execute(new JpaCallback<Integer>() {
public Integer doInJpa(EntityManager em) throws PersistenceException {
return em.createNamedQuery("Book.updateAuthor")
.setParameter(1, null)
.setParameter(2, b.getId())
.executeUpdate();
}
}, true);
return k;
}