6 Replies Latest reply on Oct 9, 2007 11:57 AM by Ravi Nallakukkala

    Losing Home#instance reference

    Ravi Nallakukkala Newbie

      Hi there,

      I'm fairly new the seam world and currently using code base of seam 2 nightly build. was trying to do our business validation and landed into a scenario where my home#instance variable reference is lost upon invocation of an another seam component's method.

      here's my code
      Home bean

      public class MembershipHome extends EntityHome<Membership> {
      private MembershipValidation membershipValidation;
       public String persist(){
       Membership instance = getInstance();
       membershipValidation.validate();// loosing the reference of the instance variable after this call.
       setInstance(instance);//explicit setting of the instance works as expected, but nasty right?
       if(!membershipValidation.isEmpty()) {
       return "error";//TODO is there any standard form that Seam recommand
       return super.persist();

      Here's my validation class
      public class MembershipValidation extends BaseValidator{
       public final static String COMPONENT_NAME ="membershipValidation";
       private MembershipHome membershipHome;
       public void validate(){
       << some crazy validations>>

      Now the problem I'm running to is

      Prior to the "membershipValidation.validate();" method invocation, the home object has the reference to the entity instance, but after the method invocation the "instance" reference is lost.

      Please note that explicit setting of the instance reference after this method call (membershipValidation.validate()) works as expected; but explicit setting of the setInstance isnt looking beautiful though :-(.

      Can you suggest me what's taking me wrong?