Section 7.9.1 of the JPA spec states that in a container managed persistence context (that's what you get with LocalContainerEntityManagerFactoryBean), calls to persist(…), merge(…), etc. need to throw a TransactionRequiredException if there's no transaction in progress. However, we currently don't consider this at all which leads to the effect that code like this will not create an exception but also don't persist the entity:
Additionally calling em.flush() will trigger the exception being thrown by the persistence provider but you might run into this scenario as the code relies on a transaction being started on a layer above. If that's forgotten, you get running (invalid) code, that's not barking at you in any way.
Of course this can be worked around by e.g. using Spring Data JPA (which has defaulting of transactions on the repository level) but I think we should adhere to the spec here.