KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > test > cmp2 > fkmapping > ejb > ChildCMPUnknownPKBean


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.fkmapping.ejb;
23
24
25 import javax.ejb.EntityBean JavaDoc;
26 import javax.ejb.EntityContext JavaDoc;
27 import javax.ejb.RemoveException JavaDoc;
28 import javax.ejb.CreateException JavaDoc;
29
30
31 /**
32  * @ejb.bean
33  * name="ChildUPK"
34  * type="CMP"
35  * cmp-version="2.x"
36  * view-type="local"
37  * reentrant="false"
38  * @ejb.pk
39  * class="java.lang.Object"
40  * generate="false"
41  * @ejb.util generate="physical"
42  * @ejb.persistence table-name="CHILD_UPK"
43  * @jboss.persistence
44  * create-table="true"
45  * remove-table="true"
46  * @ejb:transaction-type type="Container"
47  * @jboss.container-configuration name="INSERT after ejbPostCreate Container"
48  *
49  * @jboss.unknown-pk class="java.lang.String"
50  * @jboss.entity-command name="key-generator"
51  *
52  * @author <a HREF="mailto:alex@jboss.org">Alex Loubyansky</a>
53  */

54 public abstract class ChildCMPUnknownPKBean
55    implements EntityBean JavaDoc
56 {
57    // Attributes -----------------------------------------------
58
private EntityContext JavaDoc ctx;
59
60    // CMP accessors --------------------------------------------
61
/**
62     * @ejb.persistent-field
63     * @ejb.interface-method
64     * @ejb.persistence column-name="FIRST_NAME"
65     */

66    public abstract String JavaDoc getFirstName();
67    public abstract void setFirstName(String JavaDoc name);
68
69    /**
70     * @ejb.interface-method
71     * @ejb.relation
72     * name="Father-Child-upk"
73     * role-name="Child-has-Father"
74     * target-ejb="Parent"
75     * target-role-name="Father-has-Child"
76     * target-multiple="yes"
77     * cascade-delete="no"
78     * @jboss.relation
79     * related-pk-field="id"
80     * fk-column="FATHER_ID"
81     * @jboss.relation
82     * related-pk-field="firstName"
83     * fk-column="FATHER_NAME"
84     */

85    public abstract ParentLocal getFather();
86    /**
87     * @ejb.interface-method
88     */

89    public abstract void setFather(ParentLocal parent);
90
91    /**
92     * @ejb.interface-method
93     * @ejb.relation
94     * name="Mother-Child-upk"
95     * role-name="Child-has-Mother"
96     * target-ejb="Parent"
97     * target-role-name="Mother-has-Child"
98     * target-multiple="yes"
99     * cascade-delete="no"
100     * @jboss.relation
101     * related-pk-field="id"
102     * fk-column="MOTHER_ID"
103     * @jboss.relation
104     * related-pk-field="firstName"
105     * fk-column="MOTHER_NAME"
106     */

107    public abstract ParentLocal getMother();
108    /**
109     * @ejb.interface-method
110     */

111    public abstract void setMother(ParentLocal parent);
112
113    // EntityBean implementation -------------------------------------
114
/**
115     * @ejb.create-method
116     */

117    public Object JavaDoc ejbCreate(String JavaDoc firstName)
118       throws CreateException JavaDoc
119    {
120       setFirstName(firstName);
121       return null;
122    }
123
124    public void ejbPostCreate(Long JavaDoc id, String JavaDoc firstName) {}
125
126    /**
127     * @param ctx The new entityContext value
128     */

129    public void setEntityContext(EntityContext JavaDoc ctx)
130    {
131       this.ctx = ctx;
132    }
133
134    /**
135     * Unset the associated entity context.
136     */

137    public void unsetEntityContext()
138    {
139       this.ctx = null;
140    }
141
142    public void ejbActivate() {}
143    public void ejbLoad() {}
144    public void ejbPassivate() {}
145    public void ejbRemove() throws RemoveException JavaDoc {}
146    public void ejbStore() {}
147 }
148
Popular Tags