001: /*
002: * JBoss, Home of Professional Open Source.
003: * Copyright 2006, Red Hat Middleware LLC, and individual contributors
004: * as indicated by the @author tags. See the copyright.txt file in the
005: * distribution for a full listing of individual contributors.
006: *
007: * This is free software; you can redistribute it and/or modify it
008: * under the terms of the GNU Lesser General Public License as
009: * published by the Free Software Foundation; either version 2.1 of
010: * the License, or (at your option) any later version.
011: *
012: * This software is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * You should have received a copy of the GNU Lesser General Public
018: * License along with this software; if not, write to the Free
019: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
021: */
022: package org.jboss.test.cmp2.fkstackoverflow.ejb;
023:
024: import org.apache.log4j.Category;
025:
026: import javax.ejb.EntityBean;
027: import javax.ejb.EntityContext;
028: import javax.ejb.RemoveException;
029: import javax.ejb.CreateException;
030: import java.util.Collection;
031:
032: /**
033: * @ejb.bean
034: * name="SimpleParent"
035: * type="CMP"
036: * cmp-version="2.x"
037: * view-type="local"
038: * reentrant="false"
039: * primkey-field="id"
040: * @ejb.pk generate="false"
041: * @ejb.util generate="physical"
042: * @ejb.persistence table-name="PARENT"
043: * @ejb:transaction type="Required"
044: * @ejb:transaction-type type="Container"
045: * @jboss.persistence
046: * create-table="true"
047: * remove-table="true"
048: */
049: public abstract class SimpleParentBean implements EntityBean {
050: Category log = Category.getInstance(SimpleParentBean.class);
051: private EntityContext ctx;
052:
053: // CMP accessors
054:
055: /**
056: * @ejb.pk-field
057: * @ejb.persistent-field
058: * @ejb.interface-method
059: * @ejb.persistence column-name="PARENT_ID"
060: */
061: public abstract Long getId();
062:
063: public abstract void setId(Long id);
064:
065: /**
066: * @ejb.persistent-field
067: * @ejb.interface-method
068: * @ejb.persistence column-name="FIRST_NAME"
069: */
070: public abstract String getFirstName();
071:
072: /**
073: * @ejb.interface-method
074: */
075: public abstract void setFirstName(String firstName);
076:
077: // CMR
078:
079: /**
080: * @ejb.interface-method
081: * @ejb.relation
082: * name="parent-children-simple1"
083: * role-name="parent-has-children"
084: */
085: public abstract Collection getChildren1();
086:
087: /**
088: * @ejb.interface-method
089: */
090: public abstract void setChildren1(Collection children);
091:
092: /**
093: * @ejb.interface-method
094: * @ejb.relation
095: * name="parent-children-simple2"
096: * role-name="parent-has-children"
097: */
098: public abstract Collection getChildren2();
099:
100: /**
101: * @ejb.interface-method
102: */
103: public abstract void setChildren2(Collection children);
104:
105: // EntityBean implementation
106:
107: /**
108: * @ejb.create-method
109: */
110: public Long ejbCreate(Long id, String firstName)
111: throws CreateException {
112: setId(id);
113: setFirstName(firstName);
114: return null;
115: }
116:
117: public void ejbPostCreate(Long id, String firstName) {
118: }
119:
120: /**
121: * @param ctx The new entityContext value
122: */
123: public void setEntityContext(EntityContext ctx) {
124: this .ctx = ctx;
125: }
126:
127: /**
128: * Unset the associated entity context.
129: */
130: public void unsetEntityContext() {
131: this .ctx = null;
132: }
133:
134: public void ejbActivate() {
135: }
136:
137: public void ejbLoad() {
138: }
139:
140: public void ejbPassivate() {
141: }
142:
143: public void ejbRemove() throws RemoveException {
144: }
145:
146: public void ejbStore() {
147: }
148: }
|