I am just trying to find out JSF and JPA, but whenever I try to store an object in a database, it does not seem to write. Here is the code I'm using:
@Named @ManagedBean @SessionScoped public class BestemmingController implements Serializable{ @PersistenceUnit(unitName="RealDolmenTravelShopPU") @PersistenceContext(unitName="RealDolmenTravelShopPU") EntityManagerFactory emf = null; public void submit(){ try{ emf = Persistence.createEntityManagerFactory("RealDolmenTravelShopPU"); EntityManager em = emf.createEntityManager();
I tried using EntityTransaction, but it just stopped my application without any errors or anything else. So I left him, but still he did not forget. So, I tried to split the flash separately, but it did nothing either. I very much doubt why this does not work. It was probably a beginners mistake, but I would love it if someone here could help me.
Thanks in advance!
source share