Hibernate unable to instantiate default tuplizer - cannot find getter

£可爱£侵袭症+ 提交于 2019-11-30 11:24:33

It came to me once without any typos. I've added javassist.jar to classpath and it solved the problem.

Guillaume

Further on down the stack trace, it says this:

missing a getter for puchaseDate

You might want to check for typos ;) You're missing an R and setPurchasedate should be setPurchaseDate

It looks like the problem is probably in the capitalization: setPurchasedate() should be setPurchaseDate() (with a capital "D").

If it can help someone:

In my case there were errors in my mapping files. Classes were not referenced by their full package names. I did this mistake because I generated the mappings when my bean classes belonged to the default package (hence no package name; e.g.: Order instead of com.mypackage.Order) and then I moved my bean classes to package (in the example com.mypackage). Unfortunately mapping files did not changed accordingly with the new package definition.

My hint is redo Hibernate reverse engineering and see what it produces, comparing it with your current mapping files.

Pay attention to method name,It is case sensitive!

In my case,it could not recognize getter very well; my property name was uId and I used getUId name for getter name and when I changed it to getuId problem solved!

I included java assit.jar and it worked

<dependency>
    <groupId>javassist</groupId>
    <artifactId>javassist</artifactId>
    <version>3.12.1.GA</version>
</dependency>

I experienced the

Unable to instantiate default tuplizer [org.hibernate.tuple.entity.PojoEntityTuplizer]

because I had a momentary lapse of donkeyness when renaming a field on a POJO that I had previously mapped.

I changed the Java attribute name with my trusty IDE refactor hotkey, which does not also change the getter & setter method names. I changed the getter (because it caught my attention with its @Column annotation that I also needed to address because the table column name was changing).

I neglected, however, to change the setter, and that was the cause of the error.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!