简体   繁体   中英

Hibernate cannot find getter

I've tried all the answer I've found on stackoverflow and other websites. It's pretty common but looks like each case has its solution. I generated the mapping files using JBoss Hibernate tool on eclipse, so I'm surprised it has mapping error. Hibernate can't find the getter for idparameters (I changed the database column to all lowercase to make sure it's not some case problem, but no avail) Anybody can point out the problem?

Parameter class generated by Hibernate Parameters.java

The xml mapping generated by Hibernate Parameters.hbm.xml

And the error itself

You should follow the Java Bean naming conventions when using Hibernate. This is what you can do :

  1. In the generated Parameters class, change idparameters to idParameters .
  2. Change the getter and setter to getIdParameters and setIdParameters(Integer idParameters) .
  3. Regenerate the hibernate mapping file.

Make sure that all your getters and setters follow the Java Bean naming conventions. Example : - getGrayscale

Ensure that you do a clean java build. You are probably having an old class around that does not have this parameter in it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM