سؤال

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