Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EntityManager#find after EntityManager#flush does not work #13

Open
antidote2 opened this issue Sep 27, 2016 · 3 comments
Open

EntityManager#find after EntityManager#flush does not work #13

antidote2 opened this issue Sep 27, 2016 · 3 comments

Comments

@antidote2
Copy link

antidote2 commented Sep 27, 2016

I constructed a simple example:

The test passes with @transactional(TransactionMode.DISABLED) or fails with COMMIT at the assert line

Could you please explain what happens under the hood leading to this condition.

TEST

@Test
@Transactional(TransactionMode.COMMIT)
public void testExample() {
    B2BReader b2BReader = readerTestDataFactory.loadActiveB2BReader();
    b2BReaderRepository.example(b2BReader);
}

METHOD UNDER TEST

public void example(final B2BReader b2BReader) {
    em.createQuery("UPDATE B2BReader SET externalId = 1000 WHERE b2bReaderId = :id").setParameter("id", b2BReader.getB2bReaderId()).executeUpdate();
    em.flush();
    B2BReader freshB2BReader = em.find(B2BReader.class, b2BReader.getB2bReaderId());
    assert freshB2BReader.getExternalId() == 1000;
}

Last arquillian release version on wildfly 8, last arquillian-extension-transaction version, hibernate 4.3.5

Best Regards!

@bartoszmajsak
Copy link
Member

Could you contribute this failing test as a part of a PR from which I could take over and see what's going on under the hood?

@antidote2
Copy link
Author

Unfortunately I do not work any more in that project and would need to create an EE setup with arquillian and db.

@bartoszmajsak
Copy link
Member

No worries, I'll see what I can do :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants