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

Discussions

EJB programming & troubleshooting: Does CREATE a EntityBean mean insert a new record into DB?

  1. if we use finder methods ,the Entity Bean must be instanced!
    right?
  2. 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.