I have a Test like this:
@Transactional
@Test
public void addRemoveTest() {
MyEntitiy entity = new MyEntitiy ();
entity = textureRepository.saveAndFlush
The only way I know is to call entityManager.clear()
before calling the finder. I think you can autowire the EntityManager
into your test:
@Autowired
private EntityManager entityManager;
Your test would then look like this:
@Transactional
@Test
public void addRemoveTest() {
MyEntitiy entity = new MyEntitiy ();
entity = textureRepository.saveAndFlush(entity );
entityManager.clear();
final MyEntitiy loadedTexture = myEntityRepository.findOne(entity .getId());
}