4 Replies Latest reply on Jan 25, 2012 8:57 PM by shawkins

    Custom SQLWarning

    rokhmanov

      Hi,

       

      I want to pass some custom data from my translator back to application using SQLWarning. Basically, this is what I have in my ...Execution class:

       

          public void execute() throws TranslatorException
          {
              try
              {
                   SQLWarning message = new SQLWarning("inner");
                   SQLWarning wrapper = new SQLWarning("outer");
                   wrapper.setNextWarning(message);
                   this.context.addWarning(wrapper);
                ...
      
      

      On my attempt to retrieve this SQLWarnings on application level, the statement.getWarnings() gives me back the PartialResultsWarning (with the PartialResultsWarning.failures Map populated with the "outer" SQLWarning). The "inner" warning is completely missing.

       

      What will be the proper way to pass the custom SQLWarning back to application?

        • 1. Re: Custom SQLWarning
          shawkins

          Andriy,

           

          What you are doing should work.  I have reopened https://issues.jboss.org/browse/TEIID-1829, as I can see that we are passing back all warnings as partial results warnings.  Even if you use a SQLWarning, your exception will still be wrapped on the client by a TeiidSQLWarning.

           

          Steve

          • 2. Re: Custom SQLWarning
            shawkins

            Andriy,

             

            Please see the latest check-in under https://issues.jboss.org/browse/TEIID-1829.  Also even if you use SQLWarning as your exception, we'll wrap each top level exception in a TeiidSQLWarning and produce a chain of those.  So based upon your example above:

             

            TeiidSQLWarning warning = (TeiidSQLWarning)stmt.getWarnings();

            SQLWarning wrapper = warning.getCause();

            SQLWarning message = warning.getNextWarning();

             

            You can also use whatever exception object you like.  SQLWarnings are not required.

             

            Steve

            • 3. Re: Custom SQLWarning
              rokhmanov

              Thanks Steven, the patch works.

               

              On a little bit different subject. I am thinking about automation the process of receiving patches on our end. I see daily SNAPSHOT build ( http://hudson.jboss.org/hudson/job/Teiid%20-%20Continuous%20Build/ ), what about fixes to already released version, are the artifacts available somewhere to download? Maven JBoss Snapshots and JBoss Releases repositories does not have recently built teiid 7.6 jars (only final release from last year). If not - I'll probably set up daily build in my local Hudson using your anonymous SVN, at least for 7.7.x branch.

              • 4. Re: Custom SQLWarning
                shawkins

                Andriy,

                 

                Glad to hear the patch worked.  Unfortunately there aren't any places to pick up the maintainence brach builds or mvn artifacts at this time.  Given the dual nature of 7.7/8.0 we'll probably set up a 7.7 Hudson job, but that will not track further changes to the 7 series after 7.7 is released.  You're best bet for something other than trunk would be to have your own local build.

                 

                Steve