6 Replies Latest reply: Feb 5, 2013 10:27 PM by User_Sep RSS

    Catching Database Constraints in Jdev

    User_Sep
      Hi,

      Am using Jdev 11.1.1.5.0(R1). While violating a Constraint Eg. Primary Key, i get error as follows,

      ora-00001 : unique constraint(xx.xxx_pk) violated

      I need to show user some user friendly messages instead of the above. Pls guide me.

      -Arunkumar Kootharasan
        • 1. Re: Catching Database Constraints in Jdev
          Timo Hahn
          All in the docs: http://docs.oracle.com/cd/E35521_01/web.111230/e16182/validation_model.htm#ADFFD1398

          Timo
          • 2. Re: Catching Database Constraints in Jdev
            User_Sep
            Thank You for the document,

            I tried to use this code, but some methods/variables/classes are not found, which i ve bolded in below code, How can I proceed Pls guide me

            public class CustomErrorHandler extends DCErrorHandlerImpl {

               List<_*ExceptionMapper*_> exceptionMapperList = new ArrayList<ExceptionMapper>();
               public CustomErrorHandler() {
                 this(true);
               }
            
               public CustomErrorHandler(boolean setToThrow) {
                 super(setToThrow); 
                 exceptionMapperList.add(new *DisableJboExceptionCodesMapper()*);
               }
            
               public void reportException(DCBindingContainer bc, Exception ex) { 
                 for (*ExceptionMapper* mapper : exceptionMapperList) {
                   if (mapper.canMapException(ex)) { 
                     ex = mapper.mapException(ex);
                   } 
                 }
                 super.reportException(bc, ex);
               }
            -Arunkumar Kootharasan

            Edited by: Arunkumar Kootharasan on Feb 4, 2013 12:50 PM
            • 3. Re: Catching Database Constraints in Jdev
              Timo Hahn
              This is an old documentation bug (as I see it). You are right, that sample from the doc is missing some things (classes). You can look at the FOD sample which ships with an exception handler (http://www.oracle.com/technology/products/jdev/samples/fod/index.html). Make sure you load the sample for your jdev version!

              Timo
              • 4. Re: Catching Database Constraints in Jdev
                User_Sep
                Am sorry.

                http://www.oracle.com/technology/products/jdev/samples/fod/index.html

                The above link u mentioned redirects me to this link.
                http://www.oracle.com/technetwork/developer-tools/jdev/overview/index.html

                Am I doing right?
                • 5. Re: Catching Database Constraints in Jdev
                  Timo Hahn
                  Sorry, Oracle sometimes messes around withthe links. Try http://www.oracle.com/technetwork/developer-tools/jdev/index-095536.html
                  Scroll down to the button of the page there you find hte link to the FOD Sample of your version!


                  Timo

                  Edited by: Timo Hahn on 04.02.2013 13:19
                  • 6. Re: Catching Database Constraints in Jdev
                    User_Sep
                    Thank u.

                    -Arun