• Post Reply Bookmark Topic Watch Topic
  • New Topic

Home Interface and Remote Interface  RSS feed

 
D Gopal
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've come across Home and Remote Interfaces in the EJB specs. COuld someone explain what is the significance of this ?
Deepak
 
Soumitra Ghosh
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
By Definition Home Interface defines a bean's lifecycle method which include methods for creating new beans,finding beans & removing beans. Remote interface defines the bean's business methods.
Let's take an example now.
An office can have many departments.So in your database you can define a table named department and you can have a corresponding
Entity bean defined as 'Department'(which is nothing but a view of your table).
Now to add a new department in the office you have to use the create() method of home interface of the 'department' Entity bean.Similarly to remove a department from office you can use the remove() method of the home interface.So the syntax will be like: Instance of your Home Interface.create() ;
Instance of your Home Interface.remove() ;
Now the department table can have many fields defined like dept. no., dept name,employees no. etc.
You may want to know which employees work for a dept or you would like to change some of the field values defined in the department table, you can use Remote Interface Methods like get<Employee_Name>() or set<Employee_id>() methods (which you can define for each field of department table).So the syntax will be like:
Instance of your Remote Interface.getEmployeeName() ;
Hope this helps.


------------------
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!