1 25 package org.objectweb.easybeans.tests.common.ejbs.entity.callbacklogger; 26 27 import java.io.Serializable ; 28 import java.text.MessageFormat ; 29 30 import javax.persistence.DiscriminatorValue; 31 import javax.persistence.Entity; 32 import javax.persistence.EnumType; 33 import javax.persistence.Enumerated; 34 import javax.persistence.GeneratedValue; 35 import javax.persistence.GenerationType; 36 import javax.persistence.Id; 37 import javax.persistence.Inheritance; 38 import javax.persistence.InheritanceType; 39 import javax.persistence.NamedQueries; 40 import javax.persistence.NamedQuery; 41 import javax.persistence.Table; 42 import javax.persistence.TableGenerator; 43 44 50 @Entity 51 @Table(name = "CALLBACKLOGGER") 52 @Inheritance(strategy=InheritanceType.SINGLE_TABLE) 53 @DiscriminatorValue("Type") 54 @TableGenerator(name = "MANAGER_SEQ", allocationSize = 1) 55 @NamedQueries({ 56 @NamedQuery(name = "findAll", query = "SELECT e FROM CallbackLogger e "), 57 @NamedQuery(name = "findLifecycleEvent", query = "SELECT e FROM CallbackLogger e WHERE e.className = :className AND" 58 + " e.callbackEvent= :event"), 59 @NamedQuery(name = "findLifecycleEventByClass", query = "SELECT e FROM CallbackLogger e WHERE e.className = :className"), 60 @NamedQuery(name = "findLifecycleEventByCallbackMethod", query = "SELECT e FROM CallbackLogger e " 61 + "WHERE e.className = :className AND e.callbackClassName= :callbackClassName AND e.callbackEvent= :event")}) 62 public class CallbackLogger implements Serializable { 63 64 67 private static final long serialVersionUID = 5508063145575159629L; 68 69 72 private int id; 73 74 77 private String className; 78 79 82 private CallbackType callbackEvent; 83 84 87 private long insertionDate; 88 89 92 private String callbackClassName; 93 94 98 public String getCallbackClassName() { 99 return callbackClassName; 100 } 101 102 106 public void setCallbackClassName(final String callbackClassName) { 107 this.callbackClassName = callbackClassName; 108 } 109 110 114 @Enumerated(EnumType.STRING) 115 public CallbackType getCallbackEvent() { 116 return callbackEvent; 117 } 118 119 123 public void setCallbackEvent(final CallbackType callbackEvent) { 124 this.callbackEvent = callbackEvent; 125 } 126 127 131 public String getClassName() { 132 return className; 133 } 134 135 139 public void setClassName(final String className) { 140 this.className = className; 141 } 142 143 147 @Id 148 @GeneratedValue(strategy = GenerationType.TABLE, generator = "MANAGER_SEQ") 149 public int getId() { 150 return id; 151 } 152 153 157 public void setId(final int id) { 158 this.id = id; 159 } 160 161 165 public long getInsertionDate() { 166 return insertionDate; 167 } 168 169 173 public void setInsertionDate(final long insertionDate) { 174 this.insertionDate = insertionDate; 175 } 176 177 181 @SuppressWarnings ("boxing") 182 @Override 183 public String toString(){ 184 return MessageFormat.format("{0}, ID = {1}, ClassName = {2}, CallbackClassName = {3}, CallbackEvent = {4}, Date = {5}", 185 CallbackLogger.class.getName(), id, className, callbackClassName, callbackEvent, insertionDate); 186 } 187 } 188 | Popular Tags |