| Hi, starting from the test you provided, I created a simple reproducer:
@Test
public void simpleReproducer() {
Post post = new Post();
post.setName( "This is a post" );
EntityTransaction trx = entityManager.getTransaction();
trx.begin();
post = entityManager.merge( post );
Long postId = post.getId();
assertNotNull( postId );
entityManager.flush();
entityManager.clear();
entityManagerFactory.getCache().evictAll();
trx.commit();
trx.begin();
Post reloaded = entityManager.find( Post.class, postId );
Comment comment = new Comment();
comment.setName( "This is a comment" );
comment.setPost( reloaded );
reloaded.getComments().add( comment );
entityManager.flush();
entityManager.clear();
entityManagerFactory.getCache().evictAll();
trx.commit();
}
This test fails on the sample project. I’m trying on Hibernate Search 6…. |