/**
 * Copyright (c) 2004 Red Hat, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
 * USA
 *
 * Component of: Red Hat Application Server
 * 
 * Initial Developers: Aizaz Ahmed
 *                     Vivek Lakshmanan
 *                     Andrew Overholt
 *                     Matthew Wringe
 */

/*
 * FriendBean.java
 * 
 * Created on Aug 16, 2004
 *
 */
package olstore.entity;

import javax.ejb.EntityBean;

import olstore.entity.UserLocal;

/**
 * @ejb.bean name="Friend"
 *  description="This bean is used as an alias to User to work around the inability to define a many-many self-referencing relationship."
 *	type="CMP"
 *  schema="olstore_friend"
 *  primkey-field="id"
 *  reentrant="false"
 *  cmp-version="2.x"
 *  view-type="local"
 *  local-jndi-name="FriendLocal_L"
 * 
 * @ejb.transaction
 *  type="Required"
 *
 *
 * --
 * This is needed for JOnAS.
 * If you are not using JOnAS you can safely remove the tags below.
 * @jonas.bean ejb-name="Friend"
 * jndi-name="FriendLocal"
 * @jonas.jdbc-mapping  jndi-name="jdbc_1" jdbc-table-name="olstore_friend"
 * automatic-pk="true"  
 * --
 * 
 *  @ejb.persistence
 * 
 *--
 * This is needed for JOnAS.
 * If you are not using JOnAS you can safely remove the tags below.
 * @jonas.finder-method-jdbc-mapping  method-name="findAll"
 *	jdbc-where-clause=""
 * @jonas.jdbc-mapping  jndi-name="jdbc_1"
 *	jdbc-table-name="olstore_friend"
 * 
 *--
 *  
 **/

public abstract class FriendBean implements EntityBean {
    
    /**
     * The  ejbCreate method.
     * 
     * @ejb.create-method 
     */
    public java.lang.String ejbCreate(UserLocal user)
    throws javax.ejb.CreateException {
        return null;
    }
    
    /**
     * The container invokes this method immediately after it calls ejbCreate.
     * 
     */
    public void ejbPostCreate(UserLocal user) throws javax.ejb.CreateException {
        setUser (user);
    }
    
    /**
     * Returns user.
     * 
     * @return user
     * 
     * @ejb.relation
     *  name="Friend-User"
     *  role-name="Friend-is-an-alias-of-User"
     *  target-ejb="User"
     *  target-multiple="yes"
     * 
     * @ejb.relation
     *  name="User-Friend"
     *  role-name="Friends-are-Users"
     *  target-ejb="User"
     *  target-multiple="yes"
     * 
     * @ejb.interface-method
     * 
     */
    
    public abstract UserLocal getUser ();
    
    /**
     * 
     * @param User
     * 
     * @ejb.interface-method
     * 
     */
    
    public abstract void setUser (UserLocal User);
    
    /**
     * Returns the friend id
     * @return the friend id
     * 
     * @ejb.persistent-field 
     * @ejb.persistence
     *    column-name="id"
     *     sql-type="INTEGER"
     * @ejb.pk-field 
     * @ejb.interface-method
     * 
     */
    public abstract java.lang.Integer getId();
    
    /**
     * Sets the friend id
     * 
     * @param java.lang.Integer the new friend id value
     * 
     * @ejb.interface-method
     */
    public abstract void setId(java.lang.Integer friendId);
    
    
    
}
