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.EntityContext;
025: import javax.ejb.EntityBean;
026: import javax.ejb.EJBException;
027: import javax.ejb.RemoveException;
028: import javax.ejb.CreateException;
029: import java.rmi.RemoteException;
030: import java.util.Collection;
031:
032: /**
033: * @ejb.bean
034: * name="Institute"
035: * type="CMP"
036: * cmp-version="2.x"
037: * view-type="local"
038: * reentrant="false"
039: * local-jndi-name="Institute"
040: * @ejb.pk generate="true"
041: * @ejb.util generate="physical"
042: * @ejb.persistence table-name="INSTITUTE"
043: * @jboss.persistence
044: * create-table="true"
045: * remove-table="true"
046: *
047: * @author <a href="mailto:alex@jboss.org">Alex Loubyansky</a>
048: */
049: public abstract class InstituteEntityBean implements EntityBean {
050: // Attributes ---------------------------------------------------
051: private EntityContext ctx;
052:
053: // CMP accessors
054: /**
055: * @ejb.pk-field
056: * @ejb.persistent-field
057: * @ejb.interface-method
058: * @ejb.persistence column-name="INSTITUTE_ID"
059: */
060: public abstract String getInstituteId();
061:
062: public abstract void setInstituteId(String instituteId);
063:
064: /**
065: * @ejb.persistent-field
066: * @ejb.interface-method
067: * @ejb.persistence column-name="DESCR"
068: */
069: public abstract String getDescription();
070:
071: public abstract void setDescription(String description);
072:
073: // CMR accessors
074: /**
075: * @ejb.interface-method
076: * @ejb.relation
077: * name="Institute-Department-StandaloneFK"
078: * role-name="Institute-has-Departments"
079: */
080: public abstract Collection getDepartments();
081:
082: /**
083: * @ejb.interface-method
084: */
085: public abstract void setDepartments(Collection departments);
086:
087: // EntityBean implementation ------------------------------------
088: /**
089: * @ejb.create-method
090: */
091: public InstitutePK ejbCreate(String instituteId, String descr)
092: throws CreateException {
093: setInstituteId(instituteId);
094: setDescription(descr);
095: return null;
096: }
097:
098: public void ejbPostCreate(String instituteId, String descr) {
099: }
100:
101: public void ejbActivate() throws EJBException, RemoteException {
102: }
103:
104: public void ejbLoad() throws EJBException, RemoteException {
105: }
106:
107: public void ejbPassivate() throws EJBException, RemoteException {
108: }
109:
110: public void ejbRemove() throws RemoveException, EJBException,
111: RemoteException {
112: }
113:
114: public void ejbStore() throws EJBException, RemoteException {
115: }
116:
117: public void setEntityContext(EntityContext ctx)
118: throws EJBException, RemoteException {
119: this .ctx = ctx;
120: }
121:
122: public void unsetEntityContext() throws EJBException,
123: RemoteException {
124: this.ctx = null;
125: }
126: }
|