yes, issue was auto joining of the tx for stateful entity managers. Has
been fixed as well but probably not yet propagated to the snapshot binaries.

Now this test passes:

@RunWith(ApplicationComposer.class)
@Descriptors({
    @Descriptor(name = "persistence.xml", path =
"src/main/resources/META-INF/persistence.xml")
})
@Classes(innerClassesAsBean = true, cdi = true)
public class Run {
    @Inject
    private MyBean bean;

    @Test
    public void run() {
        assertEquals(0, bean.count());
        bean.doSomething();
        assertEquals(0, bean.count());
    }

    @Stateful
    @RequestScoped
    public static class MyBean {
        @PersistenceContext(
            type = PersistenceContextType.EXTENDED,
            synchronization = SynchronizationType.UNSYNCHRONIZED)
        private EntityManager em;

        public void doSomething() {
            em.persist(new Student());
        }

        public int count() {
            return em.createQuery("select count(s) from Student s",
Number.class).getSingleResult().intValue();
        }
    }
}

Which is what you expected.



Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com>

2015-10-26 11:17 GMT+01:00 DonatasCiuksys <[email protected]>:

> Image below shows info on em.getDelegate():
>
> <http://tomee-openejb.979440.n4.nabble.com/file/n4676608/DebugInfo2.png>
>
>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/TomEE-7-0-0-does-not-support-UNSYNCHRONIZED-PersistenceContext-tp4676564p4676608.html
> Sent from the TomEE Dev mailing list archive at Nabble.com.
>

Reply via email to