2 Replies Latest reply on Oct 26, 2007 11:26 AM by earniedyke

    Problem implementing business logic

    earniedyke

      Greetings all!!!!

      I have the following code which I intended to execute the hibernate based validation first (via the em.persist) then test for business rules. The documentation for @End says the conversation is NOT ended if the method returns null but what is happening is the em.persist is writing the data to the database even though start date is greater than end date.

      What am I doing wrong?

      Thanks in advance for any and all help!

      Earnie!

      @End
       public String saveConference() {
       log.debug("Saving "
       + (selectedConference.getId() == 0 ? "new" : selectedConference
       .getName()) + " conference");
       Object parms[] = new Object[1];
       parms[0] = selectedConference.getName();
       em.merge(selectedConference);
       log.debug("event saved to db");
       if (selectedConference.getStartDate() != null && selectedConference.getEndDate() != null && selectedConference.getEndDate().before(selectedConference.getStartDate())) {
       facesMessages.addToControlFromResourceBundle("endDate", "waitc.business.logic.event.start.end.dates", new Object[0]);
       return null;
       }
       facesMessages.addFromResourceBundle("waitc.CONFERENCE_SAVED", parms);
       getActiveConferences();
       getAdministerableConferences();
       return "maintainEvent";
       }