HarrySeah Posted November 25, 2016 Share Posted November 25, 2016 (edited) hi , im try to do the java web to connect with managed bean and connect to the javaDB (entity) class i trying to insert the record in the database but ....fail.... public void createUser(){ Booking book = new Booking(); book.setLessonno(this.l_id); book.setCustomername(strName); book.setCustomerphone(strPhone); try { utx.begin(); em.persist(book); utx.commit(); } catch (Exception e) { throw new RuntimeException(e); } } this come out a error .... java.lang.UnsupportedOperationException: Not supported yet. public void updateDB(){ EntityManagerFactory emfactory = Persistence.createEntityManagerFactory("testTrainingPU"); EntityManager entitymanager = emfactory.createEntityManager(); entitymanager.getTransaction().begin(); Lesson lesson = entitymanager.find(Lesson.class, this.l_id); lesson.setQuantity(lesson.getQuantity()-1); entitymanager.getTransaction().commit(); Booking book = new Booking(); book.setCustomername(strName); book.setCustomerphone(strPhone); book.setLessonno(this.l_id); entitymanager.persist(book); entitymanager.getTransaction().commit(); entitymanager.close(); emfactory.close(); } this way also same so how i need to solve it ...thanks Edited November 25, 2016 by HarrySeah Link to comment Share on other sites More sharing options...
justsomeguy Posted November 28, 2016 Share Posted November 28, 2016 Which line of code is that exception coming from? The stack trace should have an indication of that. Which operation is not supported? Link to comment Share on other sites More sharing options...
davej Posted November 29, 2016 Share Posted November 29, 2016 Has the Booking class been declared as an entity and annotated? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now