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.fkmapping.ejb;
023:
024: import javax.ejb.EntityBean;
025: import javax.ejb.EntityContext;
026: import javax.ejb.RemoveException;
027: import javax.ejb.CreateException;
028:
029: /**
030: * @ejb.bean
031: * name="Parent"
032: * type="CMP"
033: * cmp-version="2.x"
034: * view-type="local"
035: * reentrant="false"
036: * @ejb.pk generate="true"
037: * @ejb.util generate="physical"
038: * @ejb.persistence table-name="PARENT"
039: * @jboss.persistence
040: * create-table="true"
041: * remove-table="true"
042: * @ejb:transaction-type type="Container"
043: *
044: * @author <a href="mailto:alex@jboss.org">Alex Loubyansky</a>
045: */
046: public abstract class ParentCMPBean implements EntityBean {
047: // Attributes -----------------------------------------------
048: private EntityContext ctx;
049:
050: // CMP accessors --------------------------------------------
051: /**
052: * @ejb.pk-field
053: * @ejb.persistent-field
054: * @ejb.interface-method
055: * @ejb.persistence column-name="PARENT_ID"
056: */
057: public abstract Long getId();
058:
059: public abstract void setId(Long id);
060:
061: /**
062: * @ejb.pk-field
063: * @ejb.persistent-field
064: * @ejb.interface-method
065: * @ejb.persistence column-name="FIRST_NAME"
066: */
067: public abstract String getFirstName();
068:
069: public abstract void setFirstName(String name);
070:
071: // EntityBean implementation -------------------------------------
072: /**
073: * @ejb.create-method
074: * @throws CreateException
075: */
076: public ParentPK ejbCreate(Long parentId, String firstName)
077: throws CreateException {
078: setId(parentId);
079: setFirstName(firstName);
080: return null;
081: }
082:
083: public void ejbPostCreate(Long parentId, String firstName) {
084: }
085:
086: /**
087: * @param ctx The new entityContext value
088: */
089: public void setEntityContext(EntityContext ctx) {
090: this .ctx = ctx;
091: }
092:
093: /**
094: * Unset the associated entity context.
095: */
096: public void unsetEntityContext() {
097: this .ctx = null;
098: }
099:
100: public void ejbActivate() {
101: }
102:
103: public void ejbLoad() {
104: }
105:
106: public void ejbPassivate() {
107: }
108:
109: public void ejbRemove() throws RemoveException {
110: }
111:
112: public void ejbStore() {
113: }
114: }
|