Details

      Description

      With the default MVC setup the display of any Entity (show.jspx) will cause a full Entity graph retrieval via SQL.

      project --topLevelPackage com.ex
      
      jpa setup --provider HIBERNATE --database HYPERSONIC_IN_MEMORY
      
      enum type --class ~.reference.AuthType
      enum constant --name ROLE_USER
      enum constant --name ROLE_ADMIN
      
      entity jpa --class ~.domain.Pet
      entity jpa --class ~.domain.Owner
      entity jpa --class ~.domain.Auth
      
      field string --fieldName firstName --sizeMin 3 --sizeMax 30 --class ~.domain.Owner
      
      field string --fieldName name --notNull --sizeMin 1 --class ~.domain.Pet
      field reference --fieldName owner --type ~.domain.Owner
      
      field enum --fieldName type --type ~.reference.AuthType --notNull --class ~.domain.Auth
      field set --fieldName owners --type ~.domain.Owner --cardinality MANY_TO_MANY --fetch LAZY
      
      field set --fieldName pets --type ~.domain.Pet --mappedBy owner --notNull false --cardinality ONE_TO_MANY --class ~.domain.Owner
      field set --fieldName roles --type ~.domain.Auth --cardinality MANY_TO_MANY --fetch LAZY --mappedBy "owners"
      
      web mvc setup
      web mvc all --package ~.web
      

      If you add some entities the full tree of objects will be called via SQL. Add the following to persistence.xml to verify.

      <property name="hibernate.show_sql" value="true"/> 
      <property name="hibernate.format_sql" value="true"/>
      

      Thanks,
      Ben

        Activity

        Hide
        Ben Schochet added a comment -

        The fix is to remove some unnecessary (testing?) code in a tagx.

        If you remove the following from display.tagx the performance and SQL are as expected.

        <c:set var="sec_object" value="${fn:escapeXml(object)}" />
        

        Unless I missed something this var seems to not be used at all...

        Show
        Ben Schochet added a comment - The fix is to remove some unnecessary (testing?) code in a tagx. If you remove the following from display.tagx the performance and SQL are as expected. <c:set var = "sec_object" value= "${fn:escapeXml(object)}" /> Unless I missed something this var seems to not be used at all...
        Hide
        Alan Stewart added a comment -

        Removed sec_object in Git ID 376538bde48e30087d3db1845bf4130295396779. Please verify it fixes your issue.

        Show
        Alan Stewart added a comment - Removed sec_object in Git ID 376538bde48e30087d3db1845bf4130295396779. Please verify it fixes your issue.
        Hide
        Andrew Swan added a comment -

        We should also remove this unused tag:

        <c:set var="sec_field" value="${fn:escapeXml(field)}" />
        
        Show
        Andrew Swan added a comment - We should also remove this unused tag: <c:set var = "sec_field" value= "${fn:escapeXml(field)}" />
        Hide
        Alan Stewart added a comment -

        Done in Git ID 0b496a1ded6f2d299c6274d9313270be46ddc0f8

        Show
        Alan Stewart added a comment - Done in Git ID 0b496a1ded6f2d299c6274d9313270be46ddc0f8

          People

          • Assignee:
            Alan Stewart
            Reporter:
            Ben Schochet
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: