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.batchcascadedelete.ejb;
023:
024: import java.rmi.RemoteException;
025: import javax.ejb.CreateException;
026: import javax.ejb.EJBException;
027: import javax.ejb.EntityBean;
028: import javax.ejb.EntityContext;
029: import javax.ejb.FinderException;
030: import javax.ejb.RemoveException;
031: import javax.naming.NamingException;
032:
033: /**
034: * @author <a href="mailto:alex@jboss.org">Alexey Loubyansky</a>
035: * @version <tt>$Revision: 57211 $</tt>
036: */
037: public abstract class ChildBean implements EntityBean {
038:
039: public Long ejbCreate(Parent parent, String name)
040: throws CreateException {
041: setId(new Long(System.currentTimeMillis()));
042: setName(name);
043:
044: return null;
045: }
046:
047: public void ejbPostCreate(Parent parent, String name)
048: throws CreateException {
049: ParentLocalHome h;
050: try {
051: h = ParentUtil.getLocalHome();
052: setTheParent(h.findByPrimaryKey(parent.getId()));
053: setParentId(parent.getId().longValue());
054: } catch (NamingException e) {
055: throw new CreateException(e.toString());
056: } catch (RemoteException e) {
057: throw new CreateException(e.toString());
058: } catch (FinderException e) {
059: throw new CreateException(e.toString());
060: }
061: }
062:
063: public abstract Long getId();
064:
065: public abstract void setId(Long id);
066:
067: public abstract long getParentId();
068:
069: public abstract void setParentId(long parentId);
070:
071: public abstract String getName();
072:
073: public abstract void setName(String name);
074:
075: public ChildBean() {
076: super ();
077: }
078:
079: public abstract ParentLocal getTheParent();
080:
081: public abstract void setTheParent(ParentLocal theParent);
082:
083: public void setEntityContext(EntityContext arg0)
084: throws EJBException, RemoteException {
085: }
086:
087: public void unsetEntityContext() throws EJBException,
088: RemoteException {
089: }
090:
091: public void ejbRemove() throws RemoveException, EJBException,
092: RemoteException {
093: }
094:
095: public void ejbActivate() throws EJBException, RemoteException {
096: }
097:
098: public void ejbPassivate() throws EJBException, RemoteException {
099: }
100:
101: public void ejbLoad() throws EJBException, RemoteException {
102: }
103:
104: public void ejbStore() throws EJBException, RemoteException {
105: }
106: }
|