Announcement Announcement Module
Collapse
No announcement yet.
execute methods of StoredProcedure Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • execute methods of StoredProcedure

    Hello!
    Could u tell me why execute methods of Stored Procedure are public?
    I think that they should be protected, because they should be used only by subclasses. Also subclass cannot make it invisible (protected or private). If they were protected, subclass would make it public if it needs to.
    Thanks

  • #2
    Why? That way you would always need to provide your own execute method, while it could be perfectly fine to use the normal execute method.

    Comment


    • #3
      Originally posted by mdeinum View Post
      Why? That way you would always need to provide your own execute method, while it could be perfectly fine to use the normal execute method.
      It said in JavaDocs:
      "This class is abstract and it is intended that subclasses will provide a typed method for invocation that delegates to the supplied execute(java.util.Map) method."
      I believe it is how StoredProcedure used.
      The need to provide execute method doesnt' depend on whether it is protected or public. Even more if it is protected you should provide it otherwise clients whould have no methods to invoke.
      Last edited by wadissimo; Nov 26th, 2007, 06:23 AM.

      Comment


      • #4
        Hmm we have quite some classes which extend the StoredProcedure class, we use it with the supplied execute method. If the method would become protected, we would need to rewrite part of our application.

        Comment


        • #5
          But now we need to always use super.execute() and override execute() and throw RuntimeException from it.=(

          Comment


          • #6
            But now we need to always use super.execute() and override execute() and throw RuntimeException from it.=(
            Why? If I have an instance of StoredProcedure (be it an extension or anonymous inner class) I can simply call execute and pass in a map.

            Comment


            • #7
              I understand ur point. But we don't need to expose this method.

              Comment

              Working...
              X