我正在使用primeface计划组件并且遇到问题onEventMove事件。我的事件处理程序方法如下:
public void onEventMove(ScheduleEntryMoveEvent event) {
/* I put the id of my object as data of schedule event
* while I constructed event model.
*/
String id = (String) event.getScheduleEvent().getData();
/* And when the move event occure, find my object by
* using the data of the moved event.
*/
MyObject myObject = myObjectManager.findMyObject(id);
/* MyObject also have two attributes, startDate and endDate
*/
Date startTime = myObject.getStartDate();
Date endTime = myObject.getEndDate();
/* I print out startDate and endDate of MyObject and
* new start date and end date of moved event
*/
System.out.println(startTime);
System.out.println(endTime);
System.out.println(event.getScheduleEvent().getStartDate());
System.out.println(event.getScheduleEvent().getEndDate());
}
我的问题是输出是相同的。我的意思是声明的输出:
System.out.println(startTime);
与
的输出相同System.out.println(event.getScheduleEvent().getStartDate());
以及声明的输出
System.out.println(endTime);
与
相同System.out.println(event.getScheduleEvent().getEndDate());
有人可以建议我做错了吗?
myObjectManager 是EJB无状态会话bean的实例, myObjectManager.findMyObject(id)的源代码如下:
public MyObject findMyObject(String id) {
return myObjectEAO.find(id);
}
myObjectEAO 也是EJB无状态会话bean的一个实例, myObjectEAO.find(id)的源代码如下:
public MyObject find(String id) {
// em, here, is an instance of entity manager
return em.find(MyObject.class, id);
}