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

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: