0 Replies Latest reply on Mar 18, 2010 6:08 PM by Hai-Yun Du

    Entity Update to Database not working

    Hai-Yun Du Newbie
      I am trying to insert or update an entity to the database using the EntityHome object, but it's not working.

      @Name("personHome")
      @Scope(ScopeType.CONVERSATION)
      public class PersonHome extends EntityHome<Person> {

           @In(create = true)
           DelegationHome delegationHome;

           @Override
           @End
           public String update() {
                
                // New leader
                PersonHome leaderHome = new PersonHome();
                leaderHome.setId(delegationLeaderKey);
                Person leader = leaderHome.getInstance();
                
                // Add leader and current person entity to a new delegation record
                Delegation delegation =     delegationHome.createInstance();
                delegation.setLeader(leader);
                delegation.setDelegate(getInstance());
                
                getInstance().getDelegationsForDelegate().add(delegation);
      //          delegationHome.persist();

                return super.update();
           }
      }

      When I call personHome.update() the records do not get updated in the database even when I call persist. What am I doing wrong here?
      ||