开发者

InvalidStateException while trying to enter data into DB

开发者 https://www.devze.com 2023-02-02 07:12 出处:网络
I have a method that return the entity manager for particular DB.Now when i use the method for the first time to get entity manager everything works fine.I can save data into any tables A,B,C using en

I have a method that return the entity manager for particular DB.Now when i use the method for the first time to get entity manager everything works fine.I can save data into any tables A,B,C using entity manager.Now say i get a exception while saving in table B

Now when I try to perform any operation on DB after geting exception above, the next time i try to run same code it fails when updating in table A itself.I can see folloing eception

                                 <openjpa-1.2.2-SNAPSHOT-r422266:778978M-OPENJPA-975 nonfatal user error> org.apache.openjpa.persistence.InvalidStateException: The factory has been closed.  The stack trace at which the factory was closed is available if Runtime=TRACE logging is enabled.
    at org.apache.openjpa.kernel.AbstractBrokerFactory.assertOpen(AbstractBrokerFactory.java:673)
    at org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:182)
    at org.apache.openjpa.kernel.Delegat开发者_如何学PythoningBrokerFactory.newBroker(DelegatingBrokerFactory.java:142)
    at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:192)
    at ..


Somewhere in your code you (or a framework) close your EntityManagerFactory. Make sure you didn't call close() on it.

0

精彩评论

暂无评论...
验证码 换一张
取 消