Does CREATE a EntityBean mean insert a new record into DB?
Mike Lin
Ranch Hand
Joined: Oct 29, 2002
Posts: 48
posted
0
if we use finder methods ,the Entity Bean must have bean instanced! right?
SCJP1.4 <br />Best wishes!<br />中国人!
Sergiu Truta
Ranch Hand
Joined: Dec 16, 2003
Posts: 121
posted
0
Finder methods may return an entityLocal object or a Collection of local objects. For example if you use findByPrimaryKey() this will return a entityLocal object. EntityLocal entityLocal = null; try{ entityLocal = entityLocalHome.findByPrimaryKey(primaryKey); .................... } You can use the same sintax after using any finder method. For example, if you have a finder that returns a Collection you can write something like:
EntityLocal entityLocal = null; try{ Collection collection = entityLocalHome.findBySomeCriteria(criteria); .................... Iterator it = collection.iterator(); while(it.hasNext()){ entityLocal = (EntityLocal)it.next(); //operations on the entity... } } Hope this helps. Sergiu.
...watch me...as I'm walking the path...
Mike Lin
Ranch Hand
Joined: Oct 29, 2002
Posts: 48
posted
0
thanks very much. In fact ,what i want to know is "Does CREATE a EntityBean mean insert a new record into DB"???
Rufus BugleWeed
Ranch Hand
Joined: Feb 22, 2002
Posts: 1551
posted
0
AFAIK - create an entity bean means add a new a record to the db, yes.
shyam jakki
Ranch Hand
Joined: Dec 09, 2003
Posts: 37
posted
0
In fact ,what i want to know is "Does CREATE a EntityBean mean insert a new record into DB"???
Hi Yes Create a EntityBean means inserting a new Record to the database. Since each entity bean represents a table in the database and each instance of that bean is a row in that table. Since ejbCreate()-Insert new record ejbFindxxx()-Select-It is used to locate the entity Bean. Go through the spec and life cycle of EntityBean shyam