Monitor the changes in EOImpl.java side
2016-03-16 10:11
477 查看
You can override the doDML method and get the changes before call super.doDML();
Code with example:
Code with example:
@Override protected void doDML(int operation, TransactionEvent event) { if (operation == DML_UPDATE) { final String ORDER_ID = "OrderId"; // get posted value of OrderId attribute // this method is to get the old value before change Object oldOrderId = getPostedAttribute(this.getAttributeIndexOf(ORDER_ID)); // get value of OrderId after change Object newOrderId = this.getAttribute(ORDER_ID); // compare and take some action based on the results of comparison if (newOrderId != null && newOrderId.equals(oldOrderId)) { //do sth. here //System.out.println("Order Id changed from " + oldOrdreId + " to " + newOrderId); } // finally calling super.doDML() super.doDML(operation, event); } }
相关文章推荐
- java 编程思想 笔记摘录
- Spring整合Hibernate详细步骤
- Java Socket编程
- Java NIO系列教程(二) Channel
- Spring AOP 注解添加操作日志
- Java对象的强、软、弱和虚引用(二)
- 解决:ubuntu下eclipse的maven项目报错:Maven Dependencies
- Java NIO系列教程(一) Java NIO 概述
- JAVA中 成员变量和和实例变量一样吗?
- Java并发编程:Thread类的使用
- struts2拦截器
- Java判断两个二叉树是否相同
- Spring Bean 的作用域
- Eclipse 常用快捷键
- Java 字符串(一条日志信息)解析实例
- 简单介绍Java中Comparable和Comparator
- eclipse设置系统字体
- 使用java开发时该从哪些不同方面提高系统性能
- Java并发编程:阻塞队列
- Java过滤器,SpringMVC拦截器之间的顺序关系