Uploaded image for project: 'Tools (JBoss Tools)'
  1. Tools (JBoss Tools)
  2. JBIDE-19015

JPA Hibernate validator cannot work with the annotation @ElementCollection

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • 4.3.x
    • None
    • hibernate
    • None

      The JPA Hibernate cannot work with variables annotated with the annotation @ElementCollection. When this annotation is used and for example the annotation @ManyToOne is used as well, the JBDS shows errors at places where they shouldn't be.
      Follow my instructions to reproduce this issue:
      1. Download attached reproducer ui-ejb-minimized.zip
      2. Extract it
      3. Import the project into JBDS as an existing maven project
      4. Look at the errors. There are two errors for this project:

      Target entity is not defined	Person.java	/ui-ejb-minimized/src/main/java/org/jboss/seam/example/ui	line 25	JPA Problem
      The given name of the entity "org.jboss.seam.example.ui.Country" is empty	Country.java	/ui-ejb-minimized/src/main/java/org/jboss/seam/example/ui	line 9	JPA Problem
      

      Both of them are unnecessary because both the target entity and the name of the entity are optional.
      5. Comment the variable:

      @ElementCollection
      private List<String> notes = new ArrayList<String>();
      

      6. Save the class Person
      7. Click on Project -> Clean
      Then all the errors will disappear.
      8. uncomment the variable with the annotation back
      9. Save the class Person
      10. Click on Project -> Clean
      The two errors are back

      The attached reproducer is minimized Seam project ui-ejb of the example ui. https://github.com/seam2/jboss-seam/tree/Seam_2_3/examples/ui
      This Seam example is more complicated and the number of the wrong errors shown in JBDS is much bigger.

            kaers@redhat.com Koen Aers
            mjobanek Matous Jobanek
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: