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="ComplexParent"
035: * type="CMP"
036: * cmp-version="2.x"
037: * view-type="local"
038: * reentrant="false"
039: * @ejb.pk generate="true"
040: * @ejb.util generate="physical"
041: * @ejb.persistence table-name="COMPLEXPARENT"
042: * @ejb:transaction type="Required"
043: * @ejb:transaction-type type="Container"
044: * @jboss.persistence
045: * create-table="true"
046: * remove-table="true"
047: */
048: public abstract class ComplexParentBean implements EntityBean {
049: Category log = Category.getInstance(ComplexParentBean.class);
050: private EntityContext ctx;
051:
052: // CMP accessors
053:
054: /**
055: * @ejb.pk-field
056: * @ejb.persistent-field
057: * @ejb.interface-method
058: * @ejb.persistence column-name="PARENT_ID"
059: */
060: public abstract Long getId1();
061:
062: public abstract void setId1(Long id);
063:
064: /**
065: * @ejb.pk-field
066: * @ejb.persistent-field
067: * @ejb.interface-method
068: * @ejb.persistence column-name="PARENT_ID2"
069: */
070: public abstract Long getId2();
071:
072: public abstract void setId2(Long id);
073:
074: /**
075: * @ejb.persistent-field
076: * @ejb.interface-method
077: * @ejb.persistence column-name="FIRST_NAME"
078: */
079: public abstract String getFirstName();
080:
081: /**
082: * @ejb.interface-method
083: */
084: public abstract void setFirstName(String firstName);
085:
086: // CMR
087:
088: /**
089: * @ejb.interface-method
090: * @ejb.relation
091: * name="parent-children-complex1"
092: * role-name="parent-has-children"
093: */
094: public abstract Collection getChildren1();
095:
096: /**
097: * @ejb.interface-method
098: */
099: public abstract void setChildren1(Collection children);
100:
101: /**
102: * @ejb.interface-method
103: * @ejb.relation
104: * name="parent-children-complex2"
105: * role-name="parent-has-children"
106: */
107: public abstract Collection getChildren2();
108:
109: /**
110: * @ejb.interface-method
111: */
112: public abstract void setChildren2(Collection children);
113:
114: // EntityBean implementation
115:
116: /**
117: * @ejb.create-method
118: */
119: public ComplexParentPK ejbCreate(Long id1, Long id2,
120: String firstName) throws CreateException {
121: setId1(id1);
122: setId2(id2);
123: setFirstName(firstName);
124: return null;
125: }
126:
127: public void ejbPostCreate(Long id1, Long id2, String firstName) {
128: }
129:
130: /**
131: * @param ctx The new entityContext value
132: */
133: public void setEntityContext(EntityContext ctx) {
134: this .ctx = ctx;
135: }
136:
137: /**
138: * Unset the associated entity context.
139: */
140: public void unsetEntityContext() {
141: this .ctx = null;
142: }
143:
144: public void ejbActivate() {
145: }
146:
147: public void ejbLoad() {
148: }
149:
150: public void ejbPassivate() {
151: }
152:
153: public void ejbRemove() throws RemoveException {
154: }
155:
156: public void ejbStore() {
157: }
158: }
|