01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one
03: * or more contributor license agreements. See the NOTICE file
04: * distributed with this work for additional information
05: * regarding copyright ownership. The ASF licenses this file
06: * to you under the Apache License, Version 2.0 (the
07: * "License"); you may not use this file except in compliance
08: * with the License. You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing,
13: * software distributed under the License is distributed on an
14: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15: * KIND, either express or implied. See the License for the
16: * specific language governing permissions and limitations
17: * under the License.
18: */
19: package org.apache.openjpa.persistence.callbacks;
20:
21: import javax.persistence.PrePersist;
22: import javax.persistence.PostPersist;
23: import javax.persistence.PostLoad;
24: import javax.persistence.PreUpdate;
25: import javax.persistence.PostUpdate;
26: import javax.persistence.PreRemove;
27: import javax.persistence.PostRemove;
28:
29: public class ListenerImpl {
30:
31: static int prePersistCount;
32: static int postPersistCount;
33: static int preUpdateCount;
34: static int postUpdateCount;
35: static int preRemoveCount;
36: static int postRemoveCount;
37: static int postLoadCount;
38:
39: @PrePersist
40: public void prePersist(Object o) {
41: prePersistCount++;
42: }
43:
44: @PostPersist
45: public void postPersist(Object o) {
46: postPersistCount++;
47: }
48:
49: @PostLoad
50: public void postLoad(Object o) {
51: postLoadCount++;
52: }
53:
54: @PreUpdate
55: public void preUpdate(Object o) {
56: preUpdateCount++;
57: }
58:
59: @PostUpdate
60: public void postUpdate(Object o) {
61: postUpdateCount++;
62: }
63:
64: @PreRemove
65: public void preRemove(Object o) {
66: preRemoveCount++;
67: }
68:
69: @PostRemove
70: public void postRemove(Object o) {
71: postRemoveCount++;
72: }
73: }
|