src/org/ohmage/query/impl/AnnotationQueries.java
private long insertAnnotation(final UUID annotationId, final Long time, final DateTimeZone timezone, 
		final String client, final String annotationText, final String user)
			throws org.springframework.dao.DataAccessException {
		
		final KeyHolder annotationIdKeyHolder = new GeneratedKeyHolder();
		
		getJdbcTemplate().update(
			new PreparedStatementCreator() {
				public PreparedStatement createPreparedStatement(Connection connection) throws SQLException {
					PreparedStatement ps = connection.prepareStatement(SQL_INSERT_ANNOTATION, new String[] {"id"});
					ps.setString(1, annotationId.toString());
					ps.setLong(2, time);
					ps.setString(3, timezone.getID());
					ps.setString(4, client);
					ps.setString(5, annotationText);
					ps.setString(6, user);
					return ps;
				}
			},
			annotationIdKeyHolder
		);
		
		return annotationIdKeyHolder.getKey().longValue();
	}
/**
	 * Helper method to insert an annotation and allow the other methods in
	 * this class to do the work of linking the annotation to the appropriate
	 * entity.
	 * 
	 * @param annotationId a UUID to uniquely identify this annotation
	 * @param time the epoch millis at which the annotation was created
	 * @param timezone the timezone in which the annotation was created
	 * @param client the software client that generated the annotation request
	 * @param text the annotation text
	 * @return the primary key of the newly created annotation
	 * @throws org.springframework.dao.DataAccessException if an error occurs
	 */
Helper method to insert an annotation and allow the other methods in
this class to do the work of linking the annotation to the appropriate
entity.


Helper method to insert an annotation and allow the other methods in this class to do the work of linking the annotation to the appropriate entity .
private long insertAnnotation(final UUID annotationId, final Long time, final DateTimeZone timezone, 
		final String client, final String annotationText, final String user)
			throws org.springframework.dao.DataAccessException {
		final KeyHolder annotationIdKeyHolder = new GeneratedKeyHolder();
		getJdbcTemplate().update(
			new PreparedStatementCreator() {
				public PreparedStatement createPreparedStatement(Connection connection) throws SQLException {
					PreparedStatement ps = connection.prepareStatement(SQL_INSERT_ANNOTATION, new String[] {"id"});
					ps.setString(1, annotationId.toString());
					ps.setLong(2, time);
					ps.setString(3, timezone.getID());
					ps.setString(4, client);
					ps.setString(5, annotationText);
					ps.setString(6, user);
					return ps;
				}
			},
			annotationIdKeyHolder
		);
		return annotationIdKeyHolder.getKey().longValue();
	}
private long insertAnnotation ( final UUID annotationId , final Long time , final DateTimeZone timezone , final String client , final String annotationText , final String user ) throws org . springframework . dao . DataAccessException { final KeyHolder annotationIdKeyHolder = new GeneratedKeyHolder ( ) ; getJdbcTemplate ( ) . update ( new PreparedStatementCreator ( ) { public PreparedStatement createPreparedStatement ( Connection connection ) throws SQLException { PreparedStatement ps = connection . prepareStatement ( SQL_INSERT_ANNOTATION , new String [ ] { "id" } ) ; ps . setString ( 1 , annotationId . toString ( ) ) ; ps . setLong ( 2 , time ) ; ps . setString ( 3 , timezone . getID ( ) ) ; ps . setString ( 4 , client ) ; ps . setString ( 5 , annotationText ) ; ps . setString ( 6 , user ) ; return ps ; } } , annotationIdKeyHolder ) ; return annotationIdKeyHolder . getKey ( ) . longValue ( ) ; }
Helper method to insert an annotation and allow the other methods in
 this class to do the work of linking the annotation to the appropriate
 entity.
Helper method to insert an annotation and allow the other methods in this class to do the work of linking the annotation to the appropriate entity .