* @param event
* @param process
* @param instance
*/
static void _insertBpelEvent(Session sess, BpelEvent event, ProcessDAO process, ProcessInstanceDAO instance) {
HBpelEvent hevent = new HBpelEvent();
hevent.setTstamp(new Timestamp(System.currentTimeMillis()));
hevent.setType(BpelEvent.eventName(event));
hevent.setDetail(event.toString());
if (process != null)
hevent.setProcess((HProcess) ((ProcessDaoImpl) process).getHibernateObj());
if (instance != null)
hevent.setInstance((HProcessInstance) ((ProcessInstanceDaoImpl) instance).getHibernateObj());
if (event instanceof ScopeEvent)
hevent.setScopeId(((ScopeEvent) event).getScopeId());
try {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(bos);
oos.writeObject(event);
oos.flush();
HLargeData ld = new HLargeData(bos.toByteArray());
hevent.setData(ld);
sess.save(ld);
} catch (Throwable ex) {
// this is really unexpected.
__log.fatal("InternalError: BpelEvent serialization failed.", ex);
}