Uploaded image for project: 'Spring Roo'
  1. Spring Roo
  2. ROO-3019

(JPA and JSF 2.0) Lazy Loading problem with Set<> in Hibernate, OpenJPA etc (works with Eclipselink!)

    XMLWordPrintable

    Details

      Description

      With the Demo Project down below,
      (default Parent/Child or Box/Items project)
      you will face following two errors:

      • You did set up some Items. As soon as you want to create a Box and chose some Items, Java Server Faces will oops with "invalid value" on saving.
        Workaround: Override .equals() in Items-Clazz (see http://www.javapractices.com/topic/TopicAction.do?Id=17)
        Is there a more sophisticated solution?
      • As soon as you restart your Server (or start a new Session an other way), one cannot view the Items on a box.
        Either Edit or View panel will fail lazy loading the Set<>.
        In Hibernate this will cause a "Lazy loading error"
        In OpenJPA this will cause a "Null Pointer Exception"
        In Datanucleus ... did not compile; not able to test
        and
        In Eclipselink - IT WORKS!!! (can anyone tell my why?)

      === Source Code

      project --topLevelPackage org.example.esm --projectName ElementSetMockup
      persistence setup --provider HIBERNATE --database HYPERSONIC_PERSISTENT
      entity jpa --class ~.Box
      entity jpa --class ~.Item
      field string --fieldName name --class ~.Item
      field string --fieldName name --class ~.Box
      field set --fieldName myItems --type ~.Item
      web jsf setup
      web jsf all --package ~.jsf
      exit

        Attachments

          Activity

            People

            Assignee:
            stewarta Alan Stewart
            Reporter:
            cf1337 Christian Fischer
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: