You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In our JPA integration, it is possible that automatic DDL generation for a given persistence provider is set up deliberately or by default to be lazy. In such a case, if the first encounter with an EntityManager is from within a JTA-managed transaction, and the DDL action involves a DROP TABLE situation, and the table to be dropped doesn't exist (a very common scenario with throwaway/testing databases), then the transaction in which this occurs is rolled back and the application cannot run.
The solution to this problem is to ensure that container-managed EntityManagerFactory contextual references have a business method called on them (like, arbitrarily, isOpen(), which should of course return true) when the container comes up and before any user code has the opportunity to accidentally cause this to happen inside a transaction. This will cause the CDI proxy machinery to "inflate" the proxy and kick off what might be configured to be eager DDL generation (such as with eclipselink.deploy-on-startup and the like).
The text was updated successfully, but these errors were encountered:
In our JPA integration, it is possible that automatic DDL generation for a given persistence provider is set up deliberately or by default to be lazy. In such a case, if the first encounter with an
EntityManager
is from within a JTA-managed transaction, and the DDL action involves aDROP TABLE
situation, and the table to be dropped doesn't exist (a very common scenario with throwaway/testing databases), then the transaction in which this occurs is rolled back and the application cannot run.See #2630 as an example.
The solution to this problem is to ensure that container-managed
EntityManagerFactory
contextual references have a business method called on them (like, arbitrarily,isOpen()
, which should of course returntrue
) when the container comes up and before any user code has the opportunity to accidentally cause this to happen inside a transaction. This will cause the CDI proxy machinery to "inflate" the proxy and kick off what might be configured to be eager DDL generation (such as witheclipselink.deploy-on-startup
and the like).The text was updated successfully, but these errors were encountered: