-
Sep 1st, 2008, 11:51 AM
#1
Spring Exception Management
Hello, I've been working with Spring Framework since around a year, and I find it better each day. I built an application using JPA O/R with Spring as a container. I tried it first using Apache Tomcat, and it worked fine. Then I migrated it to IBM Websphere Application Server Community Edition (also tested it under Geronimo), and it worked fine as well.
Then I found section 12.6.1.2. "Obtaining an EntityManagerFactory from JNDI" in the Spring Reference, and I wanted to try obtaining the EM directly from the application server instead of doing it through Spring. I followed the instructions (although they weren't as clear as I would have liked) and managed to get the application up and running. This, of course, would save the extra overhead incurred by using Spring in between the application and the server.
However, when starting the application against a very badly built SQL Server database, I was surprised by the following nasty exception:
************************************************** ********
Exception while calling encodeEnd on component : {Component-Path : [Class: javax.faces.component.UIViewRoot,ViewId: /intro.jsp][Class: javax.faces.component.html.HtmlForm,Id: j_id_jsp_1063099806_1][Class: javax.faces.component.html.HtmlOutputText,Id: j_id_jsp_1063099806_2]}
Caused by:
java.sql.SQLException - Table "dbo.GUIA_DESPACHO" has a foreign key to table "dbo.ESTADOS" that has not been generated. You must run the schema generator on all inter-related tables at once.
************************************************** ********
which I didn't get when using Spring as a wrapper. I suppose that this happens because Spring has its own exception management, and thus it doesn't reflect a trivial exception such as this one to the user.
Now, the question: Isn't it possible at all to use the Spring exception masking when working with a container supplied EM? Or will I be condemned to recur to those nasty try{} catch{} blocks as the only solution and do all the exception management on my own?:o
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules