• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Quick query regarding Beans and Interfaces

 
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have been looking at some examples on the Net and I've noticed that sometimes Beans implement the Interface sometimes the Session.



I was just wondering why this is?
I have been writinmg beans using the 'Implements Interface' style, is there a specific reason for doing it this other way?
 
Ranch Hand
Posts: 153
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Keith,

Annotations were added recently in EJB 3.0 and the first type of defining a Stateless or Stateful session bean was introduced in EJB 3.0. The annotations are translated during compile time or runtime.

The second syntax was pre EJB 3.0 (EJB 1.0, 1.1, 2.0, 2.1) when your stateful or stateless session bean had to explicitly extend from SessionBean. You can still do this and it will be supported but in my opinion the newer approach is more elegant.
 
Kevin P Smith
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To continue with my question...

How do you declare a bean Entity/Session Sateless/Stateful in this newer version?

Example coding would be great, please :-D

---

Continuing from this, is this the best way to define Session & Entity Beans:-

@Stateless/Stateful
public class MyBean implements myInterface {

@Entity
@Table(name = "myTable")
public class myEntityBean implements myInterface {
[ September 04, 2007: Message edited by: Keith Wilson ]
reply
    Bookmark Topic Watch Topic
  • New Topic