-
-
Save anonymous/a3f07cf467e83bdbcda8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try { | |
new Thread() { | |
public void run() { | |
try { | |
TransactionManager transactionManager = TestingJtaPlatformImpl.INSTANCE.getTransactionManager(); | |
transactionManager.setTransactionTimeout( 5 ); | |
transactionManager.begin(); | |
EntityManager em = entityManagerFactory().createEntityManager(); | |
DataPoint dp = new DataPoint(); | |
dp.name = "foo"; | |
em.persist( dp ); | |
long id = dp.id; | |
TestingJtaPlatformImpl.tryCommit(); | |
em.close(); | |
transactionManager.begin(); | |
em = entityManagerFactory().createEntityManager(); | |
dp = em.find( DataPoint.class, id ); | |
System.out.println("FOUND dp: " + dp.name); | |
em.remove( dp ); | |
TestingJtaPlatformImpl.tryCommit(); | |
em.close(); | |
} catch (Exception e) { | |
e.printStackTrace(); | |
} | |
} | |
}.start(); | |
Thread.sleep( 30000 ); | |
} catch (Exception e) { | |
e.printStackTrace(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment