[jboss-user] [JBoss Seam] - Problem implementing business logic

earniedyke do-not-reply at jboss.com
Fri Oct 26 09:36:52 EDT 2007


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";
  | 	}
  | 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4099297#4099297

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4099297



More information about the jboss-user mailing list