public Event save(Event o) {
		final String update = "update Event set name = ?, description = ?, date = ?, location = ?";

		if (o.getLocation() != null) {
			// update location
			o.setLocation(locationDAO.save(o.getLocation()));
		}

		if (o.getId() != null) {
			// this is an update
			getSimpleJdbcTemplate().update(update, o.getName(), o.getDescription(), o.getDate(), o.getLocation() != null ? o.getLocation().getId() : null);
		}
		else {
			// this is an insert
			Map<String, Object> args = new HashMap<String, Object>(4);
			args.put("name", o.getName());
			args.put("description", o.getDescription());
			args.put("date", o.getDate());
			args.put("location", o.getLocation() != null ? o.getLocation().getId() : null);
			Number id = insertEvent.executeAndReturnKey(args);
			o.setId(id.longValue());
		}
		return o;
	}
public Event save ( Event o ) { final String update = "update Event set name = ?, description = ?, date = ?, location = ?" ; if ( o . getLocation ( ) != null ) { o . setLocation ( locationDAO . save ( o . getLocation ( ) ) ) ; } if ( o . getId ( ) != null ) { getSimpleJdbcTemplate ( ) . update ( update , o . getName ( ) , o . getDescription ( ) , o . getDate ( ) , o . getLocation ( ) != null ? o . getLocation ( ) . getId ( ) : null ) ; } else { Map < String , Object > args = new HashMap < String , Object > ( 4 ) ; args . put ( "name" , o . getName ( ) ) ; args . put ( "description" , o . getDescription ( ) ) ; args . put ( "date" , o . getDate ( ) ) ; args . put ( "location" , o . getLocation ( ) != null ? o . getLocation ( ) . getId ( ) : null ) ; Number id = insertEvent . executeAndReturnKey ( args ) ; o . setId ( id . longValue ( ) ) ; } return o ; }
/*
(non-Javadoc)

@see
example.webapp.dao.interfaces.Dao#save(example.webapp.entity.DomainObject)