Skip to content

Instantly share code, notes, and snippets.

@nakamura-to
Last active December 24, 2015 23:39
Show Gist options
  • Save nakamura-to/6882170 to your computer and use it in GitHub Desktop.
Save nakamura-to/6882170 to your computer and use it in GitHub Desktop.
EntityListener Sample with Doma 1.35.0
package tutorial.entity;
import org.seasar.doma.Entity;
@Entity(listener = CommonListener.class)
public abstract class Common {
}
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) {
}
}
@Entity(listener = DeptListener.class)
public class Dept extends Common {
}
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