Last active
December 24, 2015 23:39
-
-
Save nakamura-to/6882170 to your computer and use it in GitHub Desktop.
EntityListener Sample with Doma 1.35.0
This file contains 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 tutorial.entity; | |
import org.seasar.doma.Entity; | |
@Entity(listener = CommonListener.class) | |
public abstract class Common { | |
} |
This file contains 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 tutorial.entity; | |
import org.seasar.doma.jdbc.entity.EntityListener; | |
import org.seasar.doma.jdbc.entity.PostDeleteContext; | |
import org.seasar.doma.jdbc.entity.PostInsertContext; | |
import org.seasar.doma.jdbc.entity.PostUpdateContext; | |
import org.seasar.doma.jdbc.entity.PreDeleteContext; | |
import org.seasar.doma.jdbc.entity.PreInsertContext; | |
import org.seasar.doma.jdbc.entity.PreUpdateContext; | |
public class CommonListener<E extends Common> implements EntityListener<E> { | |
@Override | |
public void preInsert(E entity, PreInsertContext<E> context) { | |
} | |
@Override | |
public void preUpdate(E entity, PreUpdateContext<E> context) { | |
} | |
@Override | |
public void preDelete(E entity, PreDeleteContext<E> context) { | |
} | |
@Override | |
public void postInsert(E entity, PostInsertContext<E> context) { | |
} | |
@Override | |
public void postUpdate(E entity, PostUpdateContext<E> context) { | |
} | |
@Override | |
public void postDelete(E entity, PostDeleteContext<E> context) { | |
} | |
} |
This file contains 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
@Entity(listener = DeptListener.class) | |
public class Dept extends Common { | |
} |
This file contains 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 tutorial.entity; | |
public class DeptListener extends CommonListener<Dept> { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment