3 Replies Latest reply on Feb 17, 2016 2:02 PM by Tomaz Cerar

    JPAAnnotationProcessor creates map from PersistenceProperty as AnnotationValue instead of String

    Nadeem Khan Newbie

      Hi,

       

      I am using jboss eap 6.1 and observed that @PersistenceProperty is mapped to hashmap with key as "AnnotationValue" instead of String and EntityMangerImpl is not processing it because it expects key to be String. Is it correct?

      Following code snippet reads this annotation (jboss-as-jpa-7.4.0.Final-redhat-19.jar, org.jboss.as.jpa.processor.JPAAnnotationProcessor.java line 304):

       

       

      Map properties;

      AnnotationValue value = annotation.value("properties");

      AnnotationInstance[] props = value != null ? value.asNestedArray() : null;

      if (props != null) {

        properties = new HashMap();

        for (int source = 0; source < props.length; source++) {

          properties.put(props[source].value("name"), props[source].value("value"));

        }

      }

       

      The highlighted object is instance of AnnotationValue and not String which EntityManagerImpl expects and it never gets the correct property. How to pass the property annotation correctly to EntityManagerImpl without changing persistence.xml?