1 package org.hibernate.event; 3 4 import java.io.Serializable ; 5 6 import org.hibernate.engine.EntityEntry; 7 8 13 public class SaveOrUpdateEvent extends AbstractEvent { 14 15 private Object object; 16 private Serializable requestedId; 17 private String entityName; 18 private Object entity; 19 private EntityEntry entry; 20 21 public SaveOrUpdateEvent(String entityName, Object original, EventSource source) { 22 this(original, source); 23 this.entityName = entityName; 24 } 25 26 public SaveOrUpdateEvent(String entityName, Object original, Serializable id, EventSource source) { 27 this(entityName, original, source); 28 this.requestedId = id; 29 if ( requestedId == null ) { 30 throw new IllegalArgumentException ( 31 "attempt to create saveOrUpdate event with null identifier" 32 ); 33 } 34 } 35 36 public SaveOrUpdateEvent(Object object, EventSource source) { 37 super(source); 38 if ( object == null ) { 39 throw new IllegalArgumentException ( 40 "attempt to create saveOrUpdate event with null entity" 41 ); 42 } 43 this.object = object; 44 } 45 46 public Object getObject() { 47 return object; 48 } 49 50 public void setObject(Object object) { 51 this.object = object; 52 } 53 54 public Serializable getRequestedId() { 55 return requestedId; 56 } 57 58 public void setRequestedId(Serializable requestedId) { 59 this.requestedId = requestedId; 60 } 61 62 public String getEntityName() { 63 return entityName; 64 } 65 66 public void setEntityName(String entityName) { 67 this.entityName = entityName; 68 } 69 70 public Object getEntity() { 71 return entity; 72 } 73 74 public void setEntity(Object entity) { 75 this.entity = entity; 76 } 77 78 public EntityEntry getEntry() { 79 return entry; 80 } 81 82 public void setEntry(EntityEntry entry) { 83 this.entry = entry; 84 } 85 } 86 | Popular Tags |