KickJava   Java API By Example, From Geeks To Geeks.

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


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="Parent"
34  * type="CMP"
35  * cmp-version="2.x"
36  * view-type="local"
37  * reentrant="false"
38  * @ejb.pk generate="true"
39  * @ejb.util generate="physical"
40  * @ejb.persistence table-name="PARENT"
41  * @jboss.persistence
42  * create-table="true"
43  * remove-table="true"
44  * @ejb:transaction-type type="Container"
45  *
46  * @author <a HREF="mailto:alex@jboss.org">Alex Loubyansky</a>
47  */

48 public abstract class ParentCMPBean
49    implements EntityBean JavaDoc
50 {
51    // Attributes -----------------------------------------------
52
private EntityContext JavaDoc ctx;
53
54    // CMP accessors --------------------------------------------
55
/**
56     * @ejb.pk-field
57     * @ejb.persistent-field
58     * @ejb.interface-method
59     * @ejb.persistence column-name="PARENT_ID"
60     */

61    public abstract Long JavaDoc getId();
62    public abstract void setId(Long JavaDoc id);
63
64    /**
65     * @ejb.pk-field
66     * @ejb.persistent-field
67     * @ejb.interface-method
68     * @ejb.persistence column-name="FIRST_NAME"
69     */

70    public abstract String JavaDoc getFirstName();
71    public abstract void setFirstName(String JavaDoc name);
72
73    // EntityBean implementation -------------------------------------
74
/**
75     * @ejb.create-method
76     * @throws CreateException
77     */

78    public ParentPK ejbCreate(Long JavaDoc parentId, String JavaDoc firstName)
79       throws CreateException JavaDoc
80    {
81       setId(parentId);
82       setFirstName(firstName);
83       return null;
84    }
85
86    public void ejbPostCreate(Long JavaDoc parentId, String JavaDoc firstName)
87    {
88    }
89
90    /**
91     * @param ctx The new entityContext value
92     */

93    public void setEntityContext(EntityContext JavaDoc ctx)
94    {
95       this.ctx = ctx;
96    }
97
98    /**
99     * Unset the associated entity context.
100     */

101    public void unsetEntityContext()
102    {
103       this.ctx = null;
104    }
105
106    public void ejbActivate() {}
107    public void ejbLoad() {}
108    public void ejbPassivate() {}
109    public void ejbRemove() throws RemoveException JavaDoc {}
110    public void ejbStore() {}
111 }
112
Popular Tags