Why do we need a Home Interface?

Hi Guys,
I am new to EJB. i am some questions.
1) Why do we need a Homeinterface?
2) Where does container generated classes for both the interface located(assume we have 2 machine, one is client and another is server)
In RMI we hv stubs and skeletons located in client and server side....similarly how it is designed in EJB?
Thanks & Regards
-vijay

In EJB3.0 the home interface has been removed. The purpose of home interface was to serve as a factory for finding/creating/destroying an enterprise bean instance. I am not sure why exactly the architects of ejb created a home interface. May be they thought its better to have a clear seperation of responsibilities, that is home interface for the above said purpose and component interface (a.k.a remote interface) for executing the business methods. Also you need to understand that the client never deals directly with a bean instance. The client always calls a bean's home or remote interface methods whose execution is delegated to the actual bean instance. This mechanism provided more flexibility for the container in creating and managing enterprise bean's instances. Hope this helps.

Similar Messages

  • Why do we use a home interface in EJB

    I am trying to figure out why we need to use a HOME Interface in every EJB that we deploy in a container ? What is the significance ?
    Thanks

    Some info:
    A home interface defines the methods that allow a client to create, find, or remove an enterprise bean. The home interface is EJB's way of creating an object. Home interfaces act as factories to create session beans and entity beans. The home interface defines the bean's life cycle methods, One of two interfaces for an enterprise bean. The home interface defines zero or more methods for creating and removing an enterprise bean. For session beans, the home interface defines create and remove methods, while for entity beans, the home interface defines create, finder, and remove methods.
    You may want to also look up:
    http://java.sun.com/j2ee/learning/tutorial/
    http://java.sun.com/developer/onlineTraining/J2EE/Intro2/j2ee.html

  • Why do we need empty serializable interface??

    I see almost all classes implementing serializable. Why cant we have this interace declared at the Object level itself??
    abstract class Object implements Serialiazable{
    Is there any reason for not having at the object level itself.???
    And
    Why they have not put method compareTo(Object o) inside Comparable interface???

    Is there any reason for not having at the object level itself.???1. Not all objects are serializable.
    Eg:Thread, OutputStream and its subclasses, and Socket are not serializable.
    2. Serializable should be implemented judiciously.
    Extracted from Effective Java: Programming Language Guide
    Allowing a class's instances to be serialized can be as simple as adding the words
    �implements Serializable� to its declaration. Because this is so easy to do, there is
    a common misconception that serialization requires little effort on the part of the programmer.
    The truth is far more complex. While the immediate cost to make a class serializable can be
    negligible, the long-term costs are often substantial.There are numerous reasons. Please refer to the book.
    >
    And
    Why they have not put method compareTo(Object o) inside Comparable interface???[http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Comparable.html#compareTo(T)]

  • Remote and Home Interfaces

    Why do we need a home interface and remote interface for a ejb.
    Must these interfaces be there for each ejb?

    Why do we need a home interface and remote interface
    for a ejb.The Home interface is like a factory for getting to your beans. The remote interface is what you use to speak "directly" to the bean. It's remote because the bean is usually on a remote server somewhere (not in the same VM as your client code). The same is true for the home interface in terms of it being remote.
    The corresponding LocalHome and Local interfaces are for use when the bean in question is not remote.
    Must these interfaces be there for each ejb?You need either a Home and Remote or LocalHome and Local interface for all beans except Message Driven Beans.

  • Why does EJB needs two interface???

    Hi All,
    This has been asked by many ppl and many of you might be having
    the correct answer for it. Please tell me....
    Why does EJB needs two interface (Home and Remote Interface)?. Why not one?
    Thanx to all...
    Regards
    GoodieGuy

    Hi Goodie ,
    Its good question and its a very valid one , one has to have doubt
    why two , why not one ..
    Here the answer goes ..
    First of all you need to understand that its a distributed computing technique ie I mean lot of people will be accessing the bean at the same time , right ? OK , you cann't access the bean directly.
    and lastly the stateless and entity beans do instance pooling.
    The very purpose of having two interfaces is
    1) To differnentiate the bussiness logic and life cycle methods .
    2) The home interface inititates life cycle methods like creation , destruction etc .
    3) There are lot of beans in the container , and through home you are
    creating the instance or accessing one of them .
    4) Once you have home object using it we get the remote object ie the instance of the bean that you want to access if stateless any bean can be called , if statefull depending upon the parameter in create method that respective bean is created and invoked .
    In ejb 1.0 and 1.1 even though the bean and the client are in same jvm its assumed that they are remote and in 2.0 Ver we have local this is to avoid network traffic .
    Hope you have got the answer , but if u still need clarification
    read EBRoman book first and second chapters thoroughly and then proceed
    a head.
    Bye
    Mahesh L.
    ============

  • Why the console gives me the message "You should need class or interface"

    Today I copy some Java codes from the webs,I paste them on the EmEditor
    I run the program But the console give me the message "You should need class or interface" I think maybe i paste somes some errors on it So i type the program by myseif But aftering running it I get the same result "You should need class or interface"
    here is my code:
    public class foo
         static String s;
         public static void main(String[] args ){
              System.out.println("s="+s);
    }

    public class foo
         public static void main(String[] args )
    String s="Hello";
              System.out.println("s="+s);
    }run that, it will work.

  • Why do I need a hardwire for my WRVS4400N wireless router?

    I am not very technically inclined.  Plug and play is my way.  So when I got my first router (a linksys) i plugged in the ethernet cables and voila!-----internet access as well as connectivity for my xbox 360, ps3 and Wii.  The people rejoiced.
    Times change.  I was happy with my last Linksys hard-wired router, so when I finally got tired of all the wires laying around I went Linksys wireless.  BEST BUY told me the best wireless/hardwire router around is the WRVS4400N.  With this router I can have my 2 360's wireless as well as my pc.  The Wii and PS3 along with my wife's computer are hardwired.  There is also a hardwire going from the router to the Comcast cable modem.  Plug and play this, that and the other thing and voila!-----internet and gaming galore!  Once again, the people rejoiced.
    That is, until, I decided to make my wife's computer wireless.  The people rebelled.  Once my wife's pc went wireless (like my two 360's and pc),  I lost all connectivity.  No logging on to the playstation network, XBOX live, Wii surfing, and no internet access.  After many hours of turning off this, resetting that and plugging/unplugging the other thing, we finally figured out how to keep the people happy--one of the pc's has to be hard-wired to allow everything else to work (internet access, gaming, etc.).
    So the people are happy, but the king is not as his kingdom is bound by the tyranny of one ethernet cable.  Not to mention the fact that his wireless signal is unsecured.
    This makes no sense to me.  Why do I need one of the pc's to be hard-wired just to get everything else to work? 

    Trying to download firmware from this go_____ed company is like trying to pull teeth!  I mean, w_f?!  Are they trying to lose customers?
    I found answer ID 4030 and under step 2 it told me "to go to the Linksys download page, click here and verify the model and version number of your Linksys product."  I clicked on the link and that took me to "Support and Services."  I entered my model number where appropriate and that took me to some kind of small business section!  Small business?!?!?  I'm a bloody home user, not some f____ng businessman!!!!!
    Anyway, I click on this link:  Cisco Small Business (Linksys Business Series) software and firmware downloads (I know it says Small business, but where else was I supposed to go?  I mean, this is where Support and Services sent me).  That link took me to Support>Download Software.
    Under "Support>Download Software>Select a Software Product Category" I clicked on the Router Software link (which had a padlock icon next to it).  They wanted me to login again.  So I try, but I keep getting repeated (and erroneous) login errors telling me I entered my username and password incorrectly.  I checked my username and password many times.  No problems with my username or password.  Thus, a dead end there.
    I went to the "Support>Download Software>Software Search" and entered the model number of my router.  I clicked on this link:  Download Software for Cisco WRVS4400N Wireless-N Gigabit Security Router - VPN V1.0 & V1.1 : wrvs440....  Guess what?  They wanted me to login AGAIN!!!!!  So I try, but I get the same login error messages I got before!!!!!  Je___ _______ ____st!  Another dead end!
    I am at my wits end here.  Getting some kind of firmware for my router to work properly should not be this f____ng difficult!  I don't even know how to access my router's web user interface!
    Any other suggestions before I finally say goodbye to Linksys/CISCO?  Because I mean after this b______t experience, the next time I need some type of router or modem or something along those lines, I'm gonna think twice about going to Linksys/CISCO.
    P.S.  Sorry about my edited language, but if you had to go through what I did, I believe you'd be just as frustrated as I am.  I spent around $250.00 for this router and it doesn't even work right!!!!!
    Message Edited by JohnJr on 04-02-2009 10:07 PM
    Message Edited by JohnJr on 04-02-2009 10:08 PM

  • Can't find Home Interface

    [WLS6.1 sp1]
    [Solaris Sparc]
    After the wls run some times, it sometimes can't find the ejb's home
    interface. It means, i can't find the home in the JNDI tree. But if restart,
    no error. WHY?????
    And, i doubt the stable of wls. so many 'Out of memory' and 'no stack
    trace', who can direct me to right way

    None error message at deployment. At runtime, it shows
    [BusiAcctFeeEjb][getAcctBalance]ERROR]:javax.naming.NameNotFoundException:
    Unable to resolve oss.demo.balance.PreAcctHome. Resolved:
    'oss.demo.balance'
    Unresolved:'PreAcctHome' ; remaining name
    ''javax.naming.NameNotFoundException: Unable to resolve
    oss.demo.balance.PreAcctHome. Resolved: 'oss.demo.balance'
    Unresolved:'PreAcctHome' ; remaining name ''
    <<no stack trace available>>
    If restart, none change, all ok!
    "Rob Woollen" <[email protected]> ??????:[email protected]..
    airwing wrote:
    Thanks Rob.
    After the wls run some times, it sometimes can't find the ejb's
    home
    interface. It means, i can't find the home in the JNDI tree. Butif
    restart,
    no error. WHY?????this occured when I run ant again to deploy my bean. It said 'can'tlookup
    demo.test.TestHome'.I don't understand. Does this error occur during deployment, or does
    the
    client throw the exception? Can you show me the actual error message or
    stack trace?
    -- Rob
    And when I display the jndi tree in wls console, only demo.test , no
    TestHome. everything ok when
    I restart server
    "Rob Woollen" <[email protected]> ??????:[email protected]..
    airwing wrote:
    [WLS6.1 sp1]
    [Solaris Sparc]
    After the wls run some times, it sometimes can't find the ejb's
    home
    interface. It means, i can't find the home in the JNDI tree. Butif
    restart,
    no error. WHY?????You'll have to provide some more information for us to help you
    debug
    this.
    And, i doubt the stable of wls. so many 'Out of memory' and 'no
    stack
    trace', who can direct me to right wayOutOfMemory indicates that you've exhausted the JVM's heap. Perhapsyou
    need
    to increase the size.
    The no stack trace error message generally indicates that you have a
    RemoteException which had a server-side stack trace. You can turn
    the
    InstrumentStackTraces option on to see them.
    -- Rob

  • JSP Home Interface Problems

    Hi, I am havin some problems trying to create a home interface in a JSP from an enterprise bean, i am using the following code :
    <%!
         private AddressBook addressbook = null;
         public void jspInit()
              try
                   InitialContext ic = new InitialContext();
                   Object objRef = ic.lookup("java:comp/env/ejb/TheAddressBook");
                   AddressBookHome home = (AddressBookHome)PortableRemoteObject.narrow(objRef, AddressBookHome.class);
                   %> <%!
                   addressbook = home.create("a","a","a","a","a","a","a");               
              catch (RemoteException ex)
                System.out.println("Couldn't create AddressBook bean."+ ex.getMessage());
            catch (CreateException ex)
                System.out.println("Couldn't create AddressBook bean."+ ex.getMessage());
            catch (NamingException ex)
                System.out.println("Unable to lookup home: "+ "AddressBook "+ ex.getMessage());
         public void jspDestroy()
         addressbook = null;
    %>
         <%
         addressbook01 = home.create("b","a","a","a","a","a","a");
         %>However i cannot access the home interface in the body of the JSP, i.e. where addressbook01 is trying to be created. Does anyone know a way around creating the home interface so that it is accessible in the body of the JSP?
    cheers

    Milan,
    I will attempt to answer some of your questions. Others I need a little more detail on:
    1. There isn't a way to run a JSP directly from JDeveloper to TomCat. Our internal server, Web-to-Go, is what we provide for local testing and debugging.
    We do, however, support remote debugging JSPs against TomCat. You can find out more about how to set this up from the online help, and also from the JDev 3.1 Remote Debugging Online Demo Walkthroughs available on the JDeveloper OTN page.
    2. I'm not sure why this is happening, but I would just answer 'No', if your edits are getting wiped out. I have not experienced this problem myself when I select 'Yes'.
    3. Are these JSP files that JDeveloper has created (i.e. via the JSP Web Application Wizard), or ones you created yourself? Does this happen each time you open the project? What are your HTML source and root directories set to in your Project Properties? Are the JSP files located there?

  • Why is it a shared folder in the music app and why do i need internet to listen to it?

    why is it a shared folder in the music app and why do i need internet to listen to it?

    Try in order:
    - Resetting the iPod:
    Reset iPod touch:  Press and hold the On/Off Sleep/Wake button and the Home
    button at the same time for at least ten seconds, until the Apple logo appears.
    - Restore the iPod from backup via iTunes
    - Restore the iPod to factory defaults/new iPod since you may have corruption that is now in your backup
    Based on the info you provided it appears you did the restore from backup and sitll have problems.  Thus, I would just restore the iPod to factory defaults/new iPod.

  • Unable to deploy EJB 3.0 on JBoss 4.0.4GA - no home interface

    I am stuck in that my EJB3.0 project (one entity bean, one session bean and one client test bean) builds OK but somehow Eclipse Europa is unable to deploy it to JBoss (4.0.4 GA and 5 Beta) -- something to do with JNDI error as it involves javax.naming exceptions.
    My Eclipse directory structure is :-
    Titan (project name)
    |
    ejb - com.titan (package name)
    | |
    | domain -> Cabin.java (my entity bean)
    | |
    | travelagent -> TravelAgentBean.java
    | -> TravelAgentRemote.java
    |
    META_INF -> ejb-jar.xml
    -> MANIFEST.MF
    -> persistence.xml
    My ejb-jar.xml is :
    <?xml version="1.0" encoding="UTF-8"?>
    <ejb-jar id="ejb-jar_ID" version="2.1" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd">
    <display-name>Titan</display-name>
    <enterprise-beans>
    <!-- Session Beans -->
    <session >
    <display-name>TravelAgentBean</display-name>
    <ejb-name>com/titan/travelagent/ejb/TravelAgentBean</ejb-name>
    <remote>com.titan.travelagent.ejb.TravelAgentRemote</remote>
    <ejb-class>com.titan.travelagent.ejb.TravelAgentBean</ejb-class>
    <session-type>Stateless</session-type>
    <transaction-type>Container</transaction-type>
    </session>
    </enterprise-beans>
    </ejb-jar>
    And my persistence.xml is :
    <?xml version="1.0" encoding="UTF-8"?>
    <persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
    <persistence-unit name="Titan">
    <provider>org.hibernate.ejb.HibernatePersistence</provider>
    <class>com.titan.domain.Cabin</class>
    <properties>
    <property name="hibernate.connection.driver_class" value="oracle.jdbc.OracleDriver" />
    <property name="hibernate.connection.url"
    value="jdbc:oracle:thin:@localhost:1521:XE" />
    <property name="hibernate.connection.username" value="SYSTEM" />
    <property name="hibernate.connection.password" value="Swordfish1" />
    </properties>
    </persistence-unit>
    </persistence>
    I right-click on the Titan project name and choose Build Project. I get the following error message :-
    13:01:06,046 WARN [verifier] EJB spec violation:
    Bean : com/titan/travelagent/TravelAgentBean
    Section: 7.11.2
    Warning: A Session bean must implement, directly or indirectly, the javax.ejb.SessionBean interface.
    13:01:06,046 WARN [verifier] EJB spec violation:
    Bean : com/titan/travelagent/TravelAgentBean
    Section: 7.11.3
    Warning: A Session bean must define at least one ejbCreate method.
    13:01:06,046 WARN [verifier] EJB spec violation:
    Bean : com/titan/travelagent/TravelAgentBean
    Section: 7.11.1
    Warning: The session bean must implement either a remote home and remote, or a local home and a local interface or a service endpoint interface.
    13:01:06,062 ERROR [MainDeployer] Could not create deployment: file:/C:/jboss-4.0.4.GA/server/default/deploy/Titan.jar
    I don't understand, because as of EJB 3.0, you don't really need a home or local-home interface anymore...

    Using @SecurityDomain("exemplo1") in my EJB and NOT providing jboss.xml, it works.
    @SecurityDomain("exemplo1")
    @RolesAllowed("yyy")
    @Stateless(name="UserManagement")
    public class UserManagementBean implements UserManagement {
      public void add(User user) {
    }Damn! This is some serious shit... I don�t want to configure this in every single EJB.
    EJB 3.0 is nice, but some small trivial details like this and others, that was forgotten by Sun, piss me off!

  • How to find out local or home interface  was used ?

    Hi !
    are there any ways in the code of methods ejbCreate and ejbRemove in my entity EJB to find out were they called via local or home interface provided that my bean has both local or home interfaces ?
    Thenks in advance.

    Why should you care, this logic should only be implemented in the client (SEJB or Servlet). Even then it should only be used to check if there is a LocalHomeInterface. If not you get the RemoteHomeInterface. I don't understand the question completely.

  • Why we dont need sender agreement and comm channel in IDOC to file scenario

    Hi,
    there are 2 queries:
    first query :
    Scenario is "Idoc to file transfer"
    why we dont need sender agreement and communication channel for IDOC to file ,while we do need
    both of these for "File to RFC "
    Answer : which i got is because IDOC sits at ABAP stack but same is valid for RFC also.
    Then why For "IDOC to file" we dont need that.
    Second query:
    Also when i did scenario for File1-RFC-File2 scenario using BPM i have created a interface
    between XI-RFC synchronous to send data which we got from file1 in XI to RFC importing parameter
    and getting data from RFC back to File2.
    Here in IDOC to file scenario why we dont need any interfface for IDOC-XI Asynchronous.
    Regards,
    Mayank
    Edited by: mayank verdia on Jan 13, 2009 11:49 AM
    Edited by: mayank verdia on Jan 13, 2009 11:50 AM

    Dear All,
    For file to idoc scenario is there any possibility to get line items details or xml details i.e the segments and its related field details using reference id, transaction id or interface name or message id in SAP PI 7.0. I know we need to click each and every message in sxi_monitor and look for details.
    For SAP(R3 System) I can create a report and set the job for specific time period so automatically it throws the details(like reference no, document date, invoice no from) in ftp path as .csv file. The same ftp path is maintained in program.
    I wanted to check FTP--->PI postings and I have set the job at r3 system it is working fine and Im monitoring it too.
    Now the end to end scenario is FTP--->PI--->ECC(R3 system). Please help.Many Thanks.

  • Dimension declaration. Why do we need it?

    Hey, Oracle data warehouse gurus.
    It should be an easy question for you.
    Why do we need to declare dimension on the top of the dimension table (CREATE DIMENTION dimension_name ...)?
    It seems to me that many functions such as rollup, cube and the like do not need this dimension metadata.
    I am using Crystal Holos OLAP server to do data mining and reporting and again this tool (at least version 7.5) does not use dimension metadata. I suppose that some OLAP servers do.
    Thanks in advance for your answer.
    Best Regards
    Vadim

    Hello  Rajsan Madhavarajan  
    Query as a Web Service (QaaWS) is a SAP Business Objects (BOBJ)  client-side tool that allows users to create and publish Web Services that can be made available over the Web.  Once these web services are created and published,  they can be consumed like any other standard Web Service in software applications including Xcelsius and Crystal Reports.   But first we have to understand what exactly is a Web Service.
    Web Service
    A Web Service is a software system that supports  interoperable interaction over a network from one computer or machine to another but is more commonly defined as a client and a server communicating data over the Web using the HTTP Protocol. Using Web Services along with Business Objects allows a live connection of data to be used in applications such as Xcelsius and Crystal Reports through a semantic layer called a Universe.
    Query as a Web Service (QaaWS)
    The two main components in QaaWS are the Client Tool and the Server.  The QaaWS Client Tool gives the end user an easy to use wizard that allows them to create Universe queries and publish them as Web Services.  Once the QaaWS is published, any user can securely access the data that the Web Service contains as long as they have access to that server. Have a look on  image below that shows the information flow to and from the server via the client.
    Advantages to QaaWS:
    Very easy to use and intuitive interface Familiar look and feel for people who have used Web Intelligence
    Leverages existing Business Objects Universes Shares metadata with Web Intelligence, Desktop Intelligence and Crystal Reports
    Maintains Business Objects Enterprise Security
    Allows live data feeds to be incorporated into Xcelsius Dashboards and Crystal Reports

  • EJB problem with home interface

    Hi firends
    I am beginner to EJB world, and trying first EJB object i.e. Hello World program
    I prepared first Remote interface, HelloBean and it compiled also properly.
    names of program
    Remote interface : Hello
    Bean: HelloBean
    Home interface : HelloHome
    But after preparing Home interface it fails to compile at position of create()
    the declaration is
    public Hello create() throws RemoteException,CreateException
    compilation error pointing at Hello in above statement saying 'Cannot resolve symbol'
    The fact is all these files are located in same directory only
    can anyone help me in this problem as I am eger to execute my first program and want to go further in EJB
    thanx in advance
    Mandar

    Hi Mandar,
    How are you setting the classpath and what exactly is it set to?
    Unresolved symbol can only mean that the class cannot be found in the classpath. If two files are in the same directory and one has a dependency on the other then adding '.' to the classpath is all that is needed. Questions to ask yourself. Are the files in the same directory? does either include a 'package' statement? and are you absolutely certain that the classpath is set correctly (type 'set' at the command line)? Also if you have set the CLASSPATH variable, using -classpath with the javac command will override the variable.
    Check everything above and if you still have problems maybe we can get some more details if you can post the entire error message.
    Mandy

Maybe you are looking for

  • Can't Send Emails From Gmail account on iPhone

    Everytime I try to send an email from my gmail account on my phone it says "The connection to the outgoing server "smtp.gmail.com" failed. Additional Outgoing Mail Servers can be configired in Settings>Mail,Contacts,Calendars."

  • Clearing VAT GL open items with EBS

    In some countries like France and Mexico. VAT  taxes are not recognized when an invoice is issued, but when a payment is made. I want to clear VAT GL Open items using Bank reconciliation EBS. Instead of clearing using Deferred process program RFUMSV5

  • Payment to a terminated employee

    Is there a way we can pay a employee a certain wage (not basic pay) after he terminates? I understand that we can create an IT267 and run an offcycle as of a check date. Other than that, are there any other options? can this be done in regular payrol

  • How to Install/UnInstall Visual studio extension using PowerShell

    Hi all. I try to install / uninstall visual studio extension use PowerShell script But I just can find the Install like: start-process $visualextendsionpath. I can't not find the way to uninstall the extension. Do I use this command to install is cor

  • Error (-69)?  HELP!

    Everytime i try to "sync" my music onto my ipod, at any given moment in the process an error will pop up that states "Attempting to copy disk 'BRETT'S IPO' failed. An unknown error occured (-69)." What does this mean, and more importantly, what can i