Attribute [...] from managed type [...] is missing (for fields named lowerCase / upperCase

The following error message appears

java.lang.IllegalArgumentException: 
The attribute [eMailStatus] 
from the managed type [EntityTypeImpl@902966747:PersonJpaDao 
   [ javaType: class com.bitplan.smartCRM.jpa.PersonJpaDao descriptor: 
   RelationalDescriptor(com.bitplan.smartCRM.jpa.PersonJpaDao --> [DatabaseTable(Person)]),  
   mappings: 46]] 
is not present.
    at 
 org.eclipse.persistence.internal.jpa.metamodel.ManagedTypeImpl.getAttribute(ManagedTypeImpl.java:147)

      

while annotations and getters and setters are present:

 /**
   * getter for xsd:string/String EMailStatus
   * @return eMailStatus
   */
  @Column(name="eMailStatus")
  public String getEMailStatus() { 
    return getPersonImpl().getEMailStatus(); 
  }

  /**
   * setter for xsd:string/String EMailStatus
   * @param peMailStatus - new value for EMailStatus
   */
  public void setEMailStatus(String peMailStatus) { 
    getPersonImpl().setEMailStatus(peMailStatus); 
  }

      

My guess is that the naming of the field matters: if the first letter of the field is lowercase and the second is uppercase than it seems. Property names:

  • PLA
  • EMailStatus

are ok, but for example

  • eMailStatus
  • xStatus

are not.

What could be here and how can I debug this to find out how to fix it?

I'm guessing the JavaBean spec capitalization rules are the culprit here, as pointed out in the comment Where is the JavaBean property naming convention defined?

+3


source to share


1 answer


Fragment of the Criteria request:

Path<String> beanValue = qh.from.<String> get(beanField);

      

Should be done with EMailStatus and not eMailStatus as the content of the beanField - even if the property name is eMailStatus and only the recipient has the top "E" cell due to java beans conventions. I haven't figured out why else yet - so other answers are still appreciating.



the deactivation function of the Introspector is what might be useful here.

it also works to rename the column to "EMailStatus":

  /**
   * getter for xsd:string/String EMailStatus
   * @return eMailStatus
   */
  @Column(name="EMailStatus")
  public String getEMailStatus() { 
    return getPersonImpl().getEMailStatus(); 
  }

  /**
   * setter for xsd:string/String EMailStatus
   * @param peMailStatus - new value for EMailStatus
   */
  public void setEMailStatus(String peMailStatus) { 
    getPersonImpl().setEMailStatus(peMailStatus); 
  }

      

+4


source







All Articles