KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > test > hibernate > ejb > ProfileBean


1 /*
2   * JBoss, Home of Professional Open Source
3   * Copyright 2005, JBoss Inc., and individual contributors as indicated
4   * by the @authors tag. See the copyright.txt in the distribution for a
5   * full listing of individual contributors.
6   *
7   * This is free software; you can redistribute it and/or modify it
8   * under the terms of the GNU Lesser General Public License as
9   * published by the Free Software Foundation; either version 2.1 of
10   * the License, or (at your option) any later version.
11   *
12   * This software is distributed in the hope that it will be useful,
13   * but WITHOUT ANY WARRANTY; without even the implied warranty of
14   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15   * Lesser General Public License for more details.
16   *
17   * You should have received a copy of the GNU Lesser General Public
18   * License along with this software; if not, write to the Free
19   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21   */

22 package org.jboss.test.hibernate.ejb;
23
24 import org.jboss.test.hibernate.model.User;
25 import org.jboss.test.hibernate.ProfileService;
26
27 import javax.ejb.SessionBean JavaDoc;
28 import javax.ejb.EJBException JavaDoc;
29 import javax.ejb.SessionContext JavaDoc;
30 import java.rmi.RemoteException JavaDoc;
31 import java.util.List JavaDoc;
32
33 import org.hibernate.HibernateException;
34
35 /**
36  * An ejb to test the ejb method interception style of transparent
37  * session management.
38  *
39  * @author <a HREF="mailto:steve@hibernate.org">Steve Ebersole</a>
40  * @version $Revision: 37406 $
41  *
42  * @ejb:bean name="ProfileService"
43  * jndi-name="ProfileService"
44  * view-type="remote"
45  * type="Stateless"
46  */

47 public class ProfileBean implements SessionBean JavaDoc
48 {
49    private ProfileService delegate = new ProfileService();
50
51    /**
52     * @exception EJBException if an error occurs
53     * @ejb:interface-method
54     */

55    public User storeUser(User user) throws EJBException JavaDoc
56    {
57       try
58       {
59          return delegate.storeUser(user);
60       }
61       catch(HibernateException e)
62       {
63          throw new EJBException JavaDoc("Error performing store", e);
64       }
65    }
66
67    /**
68     * @exception EJBException if an error occurs
69     * @ejb:interface-method
70     */

71    public User loadUser(long id) throws EJBException JavaDoc
72    {
73       try
74       {
75          return delegate.loadUser(id);
76       }
77       catch(HibernateException e)
78       {
79          throw new EJBException JavaDoc("Error performing load", e);
80       }
81    }
82
83    /**
84     * @exception EJBException if an error occurs
85     * @ejb:interface-method
86     */

87    public User loadUser(Long JavaDoc id) throws EJBException JavaDoc
88    {
89       try
90       {
91          return delegate.loadUser(id);
92       }
93       catch(HibernateException e)
94       {
95          throw new EJBException JavaDoc("Error performing load", e);
96       }
97    }
98
99    /**
100     * @exception EJBException if an error occurs
101     * @ejb:interface-method
102     */

103    public List JavaDoc listUsers() throws EJBException JavaDoc
104    {
105       try
106       {
107          return delegate.listUsers();
108       }
109       catch(HibernateException e)
110       {
111          throw new EJBException JavaDoc("Error performing list", e);
112       }
113    }
114
115    /**
116     * @ejb:create-method
117     */

118    public void ejbCreate()
119    {
120    }
121
122    public void ejbActivate() throws EJBException JavaDoc, RemoteException JavaDoc
123    {
124    }
125
126    public void ejbPassivate() throws EJBException JavaDoc, RemoteException JavaDoc
127    {
128    }
129
130    public void ejbRemove() throws EJBException JavaDoc, RemoteException JavaDoc
131    {
132    }
133
134    public void setSessionContext(SessionContext JavaDoc ctx) throws EJBException JavaDoc, RemoteException JavaDoc
135    {
136    }
137 }
138
Popular Tags