Relative Content

Tag Archive for javaspringhibernate

Java, spring, @Transactional

What will happen when we use entity.saveAndFlush() inside method that is annotated as Transactional in case of a rollback. I understand that we will synchronized changes inside persistence context, but crucial question is how rollback is going to affect those changes.

Java, spring, @Transactional

What will happen when we use entity.saveAndFlush() inside method that is annotated as Transactional in case of a rollback. I understand that we will synchronized changes inside persistence context, but crucial question is how rollback is going to affect those changes.

Java, spring, @Transactional

What will happen when we use entity.saveAndFlush() inside method that is annotated as Transactional in case of a rollback. I understand that we will synchronized changes inside persistence context, but crucial question is how rollback is going to affect those changes.

Java, spring, @Transactional

What will happen when we use entity.saveAndFlush() inside method that is annotated as Transactional in case of a rollback. I understand that we will synchronized changes inside persistence context, but crucial question is how rollback is going to affect those changes.

Java, spring, @Transactional

What will happen when we use entity.saveAndFlush() inside method that is annotated as Transactional in case of a rollback. I understand that we will synchronized changes inside persistence context, but crucial question is how rollback is going to affect those changes.

Update updated_by and updated_date on soft delete in Hibernate

I implemented soft delete using @SQLDelete(sql="UPDATE table_name SET deleted = true WHERE id = ?") and it works fine. But how to update ‘updated_by’ and ‘updated_date’. I can update ‘updated_date’ by inserting for example updated_date = now() into above query but how to update ‘updated_by’ for which I need user id that i get using SecurityContextHolder.

Update updated_by and updated_date on soft delete in Hibernate

I implemented soft delete using @SQLDelete(sql="UPDATE table_name SET deleted = true WHERE id = ?") and it works fine. But how to update ‘updated_by’ and ‘updated_date’. I can update ‘updated_date’ by inserting for example updated_date = now() into above query but how to update ‘updated_by’ for which I need user id that i get using SecurityContextHolder.