I am marking some of JPA class with predefined interface say Auditable. Now I want to invoke EntityListeners Auditor @PrePersist marked method. This has to be done to only those entity which implements this interface. I can see we can do this on Parent Classes but are interface allowed ?

有帮助吗?

解决方案

Using interface is wrong here it is you must use abstract class ,interface is just used to represent class behavior not persistent field. by the way try see eclipse link they support additional thing in interface. http://en.wikibooks.org/wiki/Java_Persistence/Advanced_Topics#Interfaces

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top