KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > test > cmp2 > batchcascadedelete > ejb > ChildBean


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.test.cmp2.batchcascadedelete.ejb;
23
24 import java.rmi.RemoteException JavaDoc;
25 import javax.ejb.CreateException JavaDoc;
26 import javax.ejb.EJBException JavaDoc;
27 import javax.ejb.EntityBean JavaDoc;
28 import javax.ejb.EntityContext JavaDoc;
29 import javax.ejb.FinderException JavaDoc;
30 import javax.ejb.RemoveException JavaDoc;
31 import javax.naming.NamingException JavaDoc;
32
33 /**
34  * @author <a HREF="mailto:alex@jboss.org">Alexey Loubyansky</a>
35  * @version <tt>$Revision: 37406 $</tt>
36  */

37 public abstract class ChildBean
38    implements EntityBean JavaDoc
39 {
40
41    public Long JavaDoc ejbCreate(Parent parent, String JavaDoc name) throws CreateException JavaDoc
42    {
43       setId(new Long JavaDoc(System.currentTimeMillis()));
44       setName(name);
45
46       return null;
47    }
48
49    public void ejbPostCreate(Parent parent, String JavaDoc name) throws CreateException JavaDoc
50    {
51       ParentLocalHome h;
52       try
53       {
54          h = ParentUtil.getLocalHome();
55          setTheParent(h.findByPrimaryKey(parent.getId()));
56          setParentId(parent.getId().longValue());
57       }
58       catch(NamingException JavaDoc e)
59       {
60          throw new CreateException JavaDoc(e.toString());
61       }
62       catch(RemoteException JavaDoc e)
63       {
64          throw new CreateException JavaDoc(e.toString());
65       }
66       catch(FinderException JavaDoc e)
67       {
68          throw new CreateException JavaDoc(e.toString());
69       }
70    }
71
72    public abstract Long JavaDoc getId();
73
74    public abstract void setId(Long JavaDoc id);
75
76    public abstract long getParentId();
77
78    public abstract void setParentId(long parentId);
79
80    public abstract String JavaDoc getName();
81
82    public abstract void setName(String JavaDoc name);
83
84    public ChildBean()
85    {
86       super();
87    }
88
89    public abstract ParentLocal getTheParent();
90
91    public abstract void setTheParent(ParentLocal theParent);
92
93
94    public void setEntityContext(EntityContext JavaDoc arg0) throws EJBException JavaDoc, RemoteException JavaDoc
95    {
96    }
97
98    public void unsetEntityContext() throws EJBException JavaDoc, RemoteException JavaDoc
99    {
100    }
101
102    public void ejbRemove() throws RemoveException JavaDoc, EJBException JavaDoc, RemoteException JavaDoc
103    {
104    }
105
106    public void ejbActivate() throws EJBException JavaDoc, RemoteException JavaDoc
107    {
108    }
109
110    public void ejbPassivate() throws EJBException JavaDoc, RemoteException JavaDoc
111    {
112    }
113
114    public void ejbLoad() throws EJBException JavaDoc, RemoteException JavaDoc
115    {
116    }
117
118    public void ejbStore() throws EJBException JavaDoc, RemoteException JavaDoc
119    {
120    }
121 }
122
Popular Tags