KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > test > cmp2 > fkstackoverflow > ejb > ComplexParentBean


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.fkstackoverflow.ejb;
23
24 import org.jboss.logging.Logger;
25
26 import javax.ejb.EntityBean JavaDoc;
27 import javax.ejb.EntityContext JavaDoc;
28 import javax.ejb.RemoveException JavaDoc;
29 import javax.ejb.CreateException JavaDoc;
30 import java.util.Collection JavaDoc;
31
32
33 /**
34  * @ejb.bean
35  * name="ComplexParent"
36  * type="CMP"
37  * cmp-version="2.x"
38  * view-type="local"
39  * reentrant="false"
40  * @ejb.pk generate="true"
41  * @ejb.util generate="physical"
42  * @ejb.persistence table-name="COMPLEXPARENT"
43  * @ejb:transaction type="Required"
44  * @ejb:transaction-type type="Container"
45  * @jboss.persistence
46  * create-table="true"
47  * remove-table="true"
48  */

49 public abstract class ComplexParentBean
50    implements EntityBean JavaDoc
51 {
52    Logger log = Logger.getLogger(ComplexParentBean.class);
53    private EntityContext JavaDoc ctx;
54
55    // CMP accessors
56

57    /**
58     * @ejb.pk-field
59     * @ejb.persistent-field
60     * @ejb.interface-method
61     * @ejb.persistence column-name="PARENT_ID"
62     */

63    public abstract Long JavaDoc getId1();
64    public abstract void setId1(Long JavaDoc id);
65
66    /**
67     * @ejb.pk-field
68     * @ejb.persistent-field
69     * @ejb.interface-method
70     * @ejb.persistence column-name="PARENT_ID2"
71     */

72    public abstract Long JavaDoc getId2();
73    public abstract void setId2(Long JavaDoc id);
74
75    /**
76     * @ejb.persistent-field
77     * @ejb.interface-method
78     * @ejb.persistence column-name="FIRST_NAME"
79     */

80    public abstract String JavaDoc getFirstName();
81    /**
82     * @ejb.interface-method
83     */

84    public abstract void setFirstName(String JavaDoc firstName);
85
86    // CMR
87

88    /**
89     * @ejb.interface-method
90     * @ejb.relation
91     * name="parent-children-complex1"
92     * role-name="parent-has-children"
93     */

94    public abstract Collection JavaDoc getChildren1();
95    /**
96     * @ejb.interface-method
97     */

98    public abstract void setChildren1(Collection JavaDoc children);
99
100    /**
101     * @ejb.interface-method
102     * @ejb.relation
103     * name="parent-children-complex2"
104     * role-name="parent-has-children"
105     */

106    public abstract Collection JavaDoc getChildren2();
107    /**
108     * @ejb.interface-method
109     */

110    public abstract void setChildren2(Collection JavaDoc children);
111
112    // EntityBean implementation
113

114    /**
115     * @ejb.create-method
116     */

117    public ComplexParentPK ejbCreate(Long JavaDoc id1, Long JavaDoc id2, String JavaDoc firstName)
118       throws CreateException JavaDoc
119    {
120       setId1(id1);
121       setId2(id2);
122       setFirstName(firstName);
123       return null;
124    }
125
126    public void ejbPostCreate(Long JavaDoc id1, Long JavaDoc id2, String JavaDoc firstName)
127    {
128    }
129
130    /**
131     * @param ctx The new entityContext value
132     */

133    public void setEntityContext(EntityContext JavaDoc ctx)
134    {
135       this.ctx = ctx;
136    }
137
138    /**
139     * Unset the associated entity context.
140     */

141    public void unsetEntityContext()
142    {
143       this.ctx = null;
144    }
145
146    public void ejbActivate() {}
147    public void ejbLoad() {}
148    public void ejbPassivate() {}
149    public void ejbRemove() throws RemoveException JavaDoc {}
150    public void ejbStore() {}
151 }
152
Popular Tags