Whether it is possible to use a entity bean with out using home.create() method
That is i want my entity bean to load a particular record based on the primary key i am passing. All the examples in the tutorial are given like they are inserting a row into the database by the way of calling home.create which means currently all the instance variables will be allocated then they are calling the Business method.
If you not getting what i am trying to say, follow the coding below
i am assuming that i have a remote and home and i am having accno and balance are instance variables. Then with out calling the home.create() method i want get the balance.
When you're talking about entity beans (which you seem to be) you don't use create() to get an EjbObject stub unless you're actually inserting a new record in your datastore.
You use a finder or select method, of which findByPrimaryKey(Object pk) is the only required one.
If it's not working you have something wrong in your code. For example you may have a CMP bean where you implemented the finder method, something you should leave to the application server. Or maybe there is no record with the key you supplied.
Attractive, successful people love this tiny ad:
Download Free Java APIs to Work with Office Files and PDF