KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > ejb3 > test > entitycallback > TrainJourney


1 /*
2   * JBoss, Home of Professional Open Source
3   * Copyright 2005, JBoss Inc., and individual contributors as indicated
4   * by the @authors tag. See the copyright.txt in the distribution for a
5   * full listing of individual contributors.
6   *
7   * This is free software; you can redistribute it and/or modify it
8   * under the terms of the GNU Lesser General Public License as
9   * published by the Free Software Foundation; either version 2.1 of
10   * the License, or (at your option) any later version.
11   *
12   * This software is distributed in the hope that it will be useful,
13   * but WITHOUT ANY WARRANTY; without even the implied warranty of
14   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15   * Lesser General Public License for more details.
16   *
17   * You should have received a copy of the GNU Lesser General Public
18   * License along with this software; if not, write to the Free
19   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21   */

22 package org.jboss.ejb3.test.entitycallback;
23
24 import javax.persistence.DiscriminatorColumn;
25 import javax.persistence.DiscriminatorType;
26 import javax.persistence.DiscriminatorValue;
27 import javax.persistence.Entity;
28 import javax.persistence.Inheritance;
29 import javax.persistence.InheritanceType;
30 import javax.persistence.PostLoad;
31 import javax.persistence.PostPersist;
32 import javax.persistence.PostRemove;
33 import javax.persistence.PostUpdate;
34 import javax.persistence.PrePersist;
35 import javax.persistence.PreRemove;
36 import javax.persistence.PreUpdate;
37
38 /**
39  * @author <a HREF="mailto:kabir.khan@jboss.org">Kabir Khan</a>
40  * @version $Revision: 40012 $
41  */

42 @Entity
43 @Inheritance(strategy = InheritanceType.SINGLE_TABLE)
44 @DiscriminatorValue("TRAIN")
45 @DiscriminatorColumn(discriminatorType = DiscriminatorType.STRING)
46 public class TrainJourney extends Journey
47 {
48    private String JavaDoc train;
49
50    public TrainJourney()
51    {
52
53    }
54
55    public TrainJourney(String JavaDoc start, String JavaDoc dest, String JavaDoc train)
56    {
57       super(start, dest);
58       this.train = train;
59    }
60
61    public String JavaDoc getTrain()
62    {
63       return train;
64    }
65
66    public void setTrain(String JavaDoc train)
67    {
68       this.train = train;
69    }
70
71    @PrePersist
72    public void doPreCreate()
73    {
74       System.out.println("TrainJourney doPreCreate");
75       CallbackCounterBean.addCallback("TrainJourney", PrePersist.class);
76    }
77
78    @PostPersist
79    public void doPostCreate()
80    {
81       System.out.println("TrainJourney doPostCreate");
82       CallbackCounterBean.addCallback("TrainJourney", PostPersist.class);
83    }
84
85    @PreRemove
86    public void doPreRemove()
87    {
88       System.out.println("TrainJourney doPreRemove");
89       CallbackCounterBean.addCallback("TrainJourney", PreRemove.class);
90    }
91
92    @PostRemove
93    public void doPostRemove()
94    {
95       System.out.println("TrainJourney doPostRemove");
96       CallbackCounterBean.addCallback("TrainJourney", PostRemove.class);
97    }
98
99    @PreUpdate
100    public void doPreUpdate()
101    {
102       System.out.println("TrainJourney doPreUpdate");
103       CallbackCounterBean.addCallback("TrainJourney", PreUpdate.class);
104    }
105
106    @PostUpdate
107    public void doPostUpdate()
108    {
109       System.out.println("TrainJourney doPostUpdate");
110       CallbackCounterBean.addCallback("TrainJourney", PostUpdate.class);
111    }
112
113    @PostLoad
114    public void doPostLoad()
115    {
116       System.out.println("TrainJourney doPostLoad");
117       CallbackCounterBean.addCallback("TrainJourney", PostLoad.class);
118    }
119
120 }
121
Popular Tags