开发者

hibernate PropertyNotFoundException

I already found some information about this exception but mine is very strange.

Caused by: org.hibernate.PropertyNotFoundException: 
Could not find a setter for property empty in class java.util.List

There is no information where is the failure. I use List in my entities but I don't understand where is the fail开发者_如何学Goure.


Hibernate is trying to persist a List object and telling you there is no setEmpty(boolean empty) method on List.

This is caused by a configuration problem trying to create a relationship between two entities.

Update:

setEmpty is not needed. The way you've configured your collection on the hibernate entity is confusing Hibernate into trying to persist a List instead of creating a relationship between rows in two tables. You need to correctly configure the one-to-many relationship in question.


I got it. I use this embedded collection in a super class and override its getter setter in subclass. The problem was, i had @ElementCollection annotation just in subclass. When i wrote it to superclass, the problem was solved. thanks for your responses.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜