EntityManager.persist()
doesn't save to database with a new entity bean I added to my project. Previously similarly added beans saves to the database.
I have tried adding EntityManager.getTransaction().commit()
, which results in an error and EntityManager.flush()
, but that results in TransactionRequiredException
.
Any help would be appreciated.
Add
EntityManager.getTransaction().begin()
beforepersist()
and thencommit()
afterwards.