How to set default value of entity/view object's attribute via SQL in Oracle adf?












0















I want to set default value of ID attribute in view object via a sql query , i.e :



SELECT (MAX(DEPTID) + 1) 
FROM DEPARTMENT;


so that I can use it as an auto-increment feature in oracle-adf. I have used sequences for it too via java but it doesn't fulfill my requirement. I also tried the SQL method myself, but when I deploy the form the page is returned blank and when I run app-module it doesn't work as well.



Image to show the SQL method I am implementing










share|improve this question





























    0















    I want to set default value of ID attribute in view object via a sql query , i.e :



    SELECT (MAX(DEPTID) + 1) 
    FROM DEPARTMENT;


    so that I can use it as an auto-increment feature in oracle-adf. I have used sequences for it too via java but it doesn't fulfill my requirement. I also tried the SQL method myself, but when I deploy the form the page is returned blank and when I run app-module it doesn't work as well.



    Image to show the SQL method I am implementing










    share|improve this question



























      0












      0








      0








      I want to set default value of ID attribute in view object via a sql query , i.e :



      SELECT (MAX(DEPTID) + 1) 
      FROM DEPARTMENT;


      so that I can use it as an auto-increment feature in oracle-adf. I have used sequences for it too via java but it doesn't fulfill my requirement. I also tried the SQL method myself, but when I deploy the form the page is returned blank and when I run app-module it doesn't work as well.



      Image to show the SQL method I am implementing










      share|improve this question
















      I want to set default value of ID attribute in view object via a sql query , i.e :



      SELECT (MAX(DEPTID) + 1) 
      FROM DEPARTMENT;


      so that I can use it as an auto-increment feature in oracle-adf. I have used sequences for it too via java but it doesn't fulfill my requirement. I also tried the SQL method myself, but when I deploy the form the page is returned blank and when I run app-module it doesn't work as well.



      Image to show the SQL method I am implementing







      sql oracle-adf default-value






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 1 at 13:12









      Gordon Linoff

      776k35306409




      776k35306409










      asked Jan 1 at 5:37









      NAJAF SIKANDERNAJAF SIKANDER

      1




      1
























          1 Answer
          1






          active

          oldest

          votes


















          0














          I tested this exact setup on JDeveloper 12.2.1.3 (current production) and it works fine. The BC Tester and Rendered page both show the incremented max dept id.



          However, the "Transient Type" for me was set to "Number" if I set the Attribute type to BigDecimal and BigInt if I selected BigInteger. I notice in your screen shot it shows the type as "$none$" - perhaps this is the issue?



          Also, if you are incrementing by a whole number, why choose BigDecimal for the Type? Shouldn't it be Integer or Big Integer?



          Also, in case you don't know - it's a recommended practice to put the EOs, VOs, Links, Assocs, etc. into separate packages to make it easier to read, etc. Go to Tools > Preferences > ADF Business Components > packages.






          share|improve this answer
























          • Whenever I try to add SQL Query in the input field in overview window it sets the type of attribute to itself automatically.

            – NAJAF SIKANDER
            Jan 2 at 7:17











          • you don't mention version of JDev/ADF - You're new here so always mention version and OS and other things to help us help you. It worked for me so not sure what to tell you. You might try doing a fresh install and test that - or log this question at the ADF community forum, here: community.oracle.com/community/groundbreakers/java/…

            – Joe
            Jan 2 at 17:32













          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53993234%2fhow-to-set-default-value-of-entity-view-objects-attribute-via-sql-in-oracle-adf%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          I tested this exact setup on JDeveloper 12.2.1.3 (current production) and it works fine. The BC Tester and Rendered page both show the incremented max dept id.



          However, the "Transient Type" for me was set to "Number" if I set the Attribute type to BigDecimal and BigInt if I selected BigInteger. I notice in your screen shot it shows the type as "$none$" - perhaps this is the issue?



          Also, if you are incrementing by a whole number, why choose BigDecimal for the Type? Shouldn't it be Integer or Big Integer?



          Also, in case you don't know - it's a recommended practice to put the EOs, VOs, Links, Assocs, etc. into separate packages to make it easier to read, etc. Go to Tools > Preferences > ADF Business Components > packages.






          share|improve this answer
























          • Whenever I try to add SQL Query in the input field in overview window it sets the type of attribute to itself automatically.

            – NAJAF SIKANDER
            Jan 2 at 7:17











          • you don't mention version of JDev/ADF - You're new here so always mention version and OS and other things to help us help you. It worked for me so not sure what to tell you. You might try doing a fresh install and test that - or log this question at the ADF community forum, here: community.oracle.com/community/groundbreakers/java/…

            – Joe
            Jan 2 at 17:32


















          0














          I tested this exact setup on JDeveloper 12.2.1.3 (current production) and it works fine. The BC Tester and Rendered page both show the incremented max dept id.



          However, the "Transient Type" for me was set to "Number" if I set the Attribute type to BigDecimal and BigInt if I selected BigInteger. I notice in your screen shot it shows the type as "$none$" - perhaps this is the issue?



          Also, if you are incrementing by a whole number, why choose BigDecimal for the Type? Shouldn't it be Integer or Big Integer?



          Also, in case you don't know - it's a recommended practice to put the EOs, VOs, Links, Assocs, etc. into separate packages to make it easier to read, etc. Go to Tools > Preferences > ADF Business Components > packages.






          share|improve this answer
























          • Whenever I try to add SQL Query in the input field in overview window it sets the type of attribute to itself automatically.

            – NAJAF SIKANDER
            Jan 2 at 7:17











          • you don't mention version of JDev/ADF - You're new here so always mention version and OS and other things to help us help you. It worked for me so not sure what to tell you. You might try doing a fresh install and test that - or log this question at the ADF community forum, here: community.oracle.com/community/groundbreakers/java/…

            – Joe
            Jan 2 at 17:32
















          0












          0








          0







          I tested this exact setup on JDeveloper 12.2.1.3 (current production) and it works fine. The BC Tester and Rendered page both show the incremented max dept id.



          However, the "Transient Type" for me was set to "Number" if I set the Attribute type to BigDecimal and BigInt if I selected BigInteger. I notice in your screen shot it shows the type as "$none$" - perhaps this is the issue?



          Also, if you are incrementing by a whole number, why choose BigDecimal for the Type? Shouldn't it be Integer or Big Integer?



          Also, in case you don't know - it's a recommended practice to put the EOs, VOs, Links, Assocs, etc. into separate packages to make it easier to read, etc. Go to Tools > Preferences > ADF Business Components > packages.






          share|improve this answer













          I tested this exact setup on JDeveloper 12.2.1.3 (current production) and it works fine. The BC Tester and Rendered page both show the incremented max dept id.



          However, the "Transient Type" for me was set to "Number" if I set the Attribute type to BigDecimal and BigInt if I selected BigInteger. I notice in your screen shot it shows the type as "$none$" - perhaps this is the issue?



          Also, if you are incrementing by a whole number, why choose BigDecimal for the Type? Shouldn't it be Integer or Big Integer?



          Also, in case you don't know - it's a recommended practice to put the EOs, VOs, Links, Assocs, etc. into separate packages to make it easier to read, etc. Go to Tools > Preferences > ADF Business Components > packages.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jan 1 at 18:57









          JoeJoe

          2,90011011




          2,90011011













          • Whenever I try to add SQL Query in the input field in overview window it sets the type of attribute to itself automatically.

            – NAJAF SIKANDER
            Jan 2 at 7:17











          • you don't mention version of JDev/ADF - You're new here so always mention version and OS and other things to help us help you. It worked for me so not sure what to tell you. You might try doing a fresh install and test that - or log this question at the ADF community forum, here: community.oracle.com/community/groundbreakers/java/…

            – Joe
            Jan 2 at 17:32





















          • Whenever I try to add SQL Query in the input field in overview window it sets the type of attribute to itself automatically.

            – NAJAF SIKANDER
            Jan 2 at 7:17











          • you don't mention version of JDev/ADF - You're new here so always mention version and OS and other things to help us help you. It worked for me so not sure what to tell you. You might try doing a fresh install and test that - or log this question at the ADF community forum, here: community.oracle.com/community/groundbreakers/java/…

            – Joe
            Jan 2 at 17:32



















          Whenever I try to add SQL Query in the input field in overview window it sets the type of attribute to itself automatically.

          – NAJAF SIKANDER
          Jan 2 at 7:17





          Whenever I try to add SQL Query in the input field in overview window it sets the type of attribute to itself automatically.

          – NAJAF SIKANDER
          Jan 2 at 7:17













          you don't mention version of JDev/ADF - You're new here so always mention version and OS and other things to help us help you. It worked for me so not sure what to tell you. You might try doing a fresh install and test that - or log this question at the ADF community forum, here: community.oracle.com/community/groundbreakers/java/…

          – Joe
          Jan 2 at 17:32







          you don't mention version of JDev/ADF - You're new here so always mention version and OS and other things to help us help you. It worked for me so not sure what to tell you. You might try doing a fresh install and test that - or log this question at the ADF community forum, here: community.oracle.com/community/groundbreakers/java/…

          – Joe
          Jan 2 at 17:32






















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53993234%2fhow-to-set-default-value-of-entity-view-objects-attribute-via-sql-in-oracle-adf%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Monofisismo

          compose and upload a new article using a custom form

          How to correct the classpath of spring boot application so that it contains a single, compatible version of...