0 Replies Latest reply on Mar 20, 2006 7:03 AM by pmuir

    Long running conversation and Hibernate Validation

    pmuir

      I'm trying to get validation to work in long running conversations:-

       @Begin(join=true)
       public String findVenues() {
       // Utility method, sets up an outjected DataModel
       findAll();
       // Redirect to result display page
       return "displayFoundVenues";
       }
      
       public String editVenue() {
       // Set the bijected venue to the DataModelSelection
       venue = selectedVenue;
       // Redirect to edit venue page
       return "editVenue";
       }
      
       @IfInvalid(outcome=Outcome.REDISPLAY)
       @End
       public String updateVenue() {
       // Clear the venues found in the previous search
       venues = null;
       // Redirect to the venue search page
       return "venueSearch";
       }
      


      If any of the fields in the venue Entity are invalid an
      InvalidStateException: validation failed for: uk.co.splendid.sms.model.venue.Venue
      

      occurs.

      If I 'split' the updateVenueMethod

       @IfInvalid(outcome=Outcome.REDISPLAY)
       @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
       public String updateVenue() {
       return "confirm";
       }
      
       @End
       public String exit() {
       venues = null;
       return "venueSearch";
       }
      


      and add in @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) then it will work fine and displays the valididation error messages. However this behaviour is not what I need - I want the user to be able to click the 'Save' button and the changes to the object to be persisted if it is valid or the screen redisplayed if it is not.

      Any ideas? If I need to post more code/log messages I can do.

      TIA

      Peter