Forked from anonymous/MyListenerAndMyEntityWithListener
Last active
August 29, 2015 13:56
-
-
Save joao-parana/8934241 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package model.entity; | |
import javax.persistence.Entity; | |
import javax.persistence.EntityListeners; | |
import javax.persistence.Id; | |
@Entity @EntityListeners(MyListener.class) | |
public class MyEntityWithListener { | |
@Id | |
private long id; | |
} | |
/* Agora o Listener */ | |
package model.entity; | |
import javax.persistence.PostLoad; | |
import javax.persistence.PostPersist; | |
import javax.persistence.PostRemove; | |
import javax.persistence.PostUpdate; | |
import javax.persistence.PrePersist; | |
import javax.persistence.PreRemove; | |
import javax.persistence.PreUpdate; | |
public class MyListener { | |
public MyListener() { | |
} | |
@PrePersist | |
void onPrePersist(Object o) { | |
} | |
@PostPersist | |
void onPostPersist(Object o) { | |
} | |
@PostLoad | |
void onPostLoad(Object o) { | |
} | |
@PreUpdate | |
void onPreUpdate(Object o) { | |
} | |
@PostUpdate | |
void onPostUpdate(Object o) { | |
} | |
@PreRemove | |
void onPreRemove(Object o) { | |
} | |
@PostRemove | |
void onPostRemove(Object o) { | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment