jQuery in Action, 2nd edition*
The moose likes EJB and other Java EE Technologies and the fly likes Does CREATE a EntityBean mean insert a new record into DB? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Does CREATE a EntityBean mean insert a new record into DB? " Watch "Does CREATE a EntityBean mean insert a new record into DB? " New topic
Author

Does CREATE a EntityBean mean insert a new record into DB?

Mike Lin
Ranch Hand

Joined: Oct 29, 2002
Posts: 48
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
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
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
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
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Does CREATE a EntityBean mean insert a new record into DB?