Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What we can write in Java Beans except setter and getter?

 
ronney singh
Ranch Hand
Posts: 40
IBM DB2 Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello to all the members,

I have been using Java Beans only for putting my setter and getter in it. I want to know that Is there anything else we can write in the EJB's except setter and getter?

Thanks in Advance
Ronney Singh
 
caleb momanyi
Ranch Hand
Posts: 43
Firefox Browser Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
they are just java classes and you can write anything in them. that's my opinion.
 
Jelle Klap
Bartender
Posts: 1951
7
Eclipse IDE Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A JavaBean is not the same thing as an EJB.

The JavaBean specification defines a set of rules / conventions that, if complied with, make a plain old Java object (POJO) a valid JavaBean. The purpose of that is to turn a Java objects into components that can be easily shared and plugged / composed into applications. What you seem to be focussing on is only one aspect of the JavaBean specification, which are properties (not to be confused with the language construct that Java does not provide), but the JavaBean specification also allows for public methods besides the methods related to properties. There are also the the event and persistence (serialization) facilities.

The EJB specification is also a set of rules that turn Java objects into components, but the key difference is that these components must be managed by an application server and the specification is far more extensive, covering the component lifecycle, transactions, concurrency, scheduling, naming, remoting, security and more.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic