FeaturesPluginsDocs & SupportCommunityPartners

NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

VWP: JPA/JSF not catching failed Oracle insert

 
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Users
View previous topic :: View next topic  
Author Message
thompsonwd40
Posted via mailing list.





PostPosted: Tue Jun 24, 2008 6:33 pm    Post subject: VWP: JPA/JSF not catching failed Oracle insert Reply with quote

My JSF/JPA code does not halt processing on failed Insert into Oracle 8i, apparently because no error is caught/thrown from Oracle or Toplink, sample code logic shown below.

Clicking the "Add" button refreshes the web page initializing all data fields as if for a successful insert (that is, my users lose all their entered data). Server.Log output below shows Phase 5, where the addRcrt() method is executed - but no record is inserted. The server.log output is the same for a successful insert as it is for a failed insert. Edits pass validator and convertor logic. I am using JPA logic in NB6.1, VWP web app; and a separate J2SE model app linked by a Persistence Unit. After much time spent debugging, I must ask for help.

=== Persistence method, with Server.log output below ====
public boolean addRcrt(Rcrt rcrt) {
EntityManager em = getEntityManager();
try {
em.getTransaction().begin(); //Establish transaction context
em.persist(rcrt); //Make rcrt entity instance persistent
em.getTransaction().commit(); //Persist data to database
} catch (IllegalStateException ise) {
System.out.println("IllegalStateException Thrown: " + ise);
} catch (IllegalArgumentException iae) {
System.out.println("IllegalArgumentException Thrown: " + iae);
} catch (TransactionRequiredException tre) {
System.out.println("TransactionRequiredException Thrown: " + tre);
} finally {
em.close(); //End the transaction context
System.out.println("RcrtController:addRcrt() Data persisted to database. em.close() ");
}
return false;
}

=== Server Log, with Phase Testing Output ===
Phase Listener:BeforePhase: RESTORE_VIEW 1
Phase Listener:BeforePhase: APPLY_REQUEST_VALUES 2
Phase Listener:BeforePhase: PROCESS_VALIDATIONS 3
Phase Listener:BeforePhase: UPDATE_MODEL_VALUES 4
Phase Listener:BeforePhase: INVOKE_APPLICATION 5
ClassWorkload addRecordButton_action() Begin
RcrtController:addRcrt() Data persisted to database. em.close()
Phase Listener:BeforePhase: RENDER_RESPONSE 6
ClassWorkload: Prerender().. iter.hasNext is false - no Faces messages..
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB