@@ -153,31 +153,25 @@ private List<ProductTestStatus> getProductTestStatuses(List<Object[]> results) {
153153 /**
154154 * This method updates the last_success_timestamp column or last_failure_timestamp column with given timestamp.
155155 * The column is selected by considering product status.
156+ * ex:- UPDATE product SET last_failure_timestamp = <timestamp> where id = <product_id>;
156157 *
157158 * @param status Status of the product
158159 * @param timestamp Current timestamp
159160 * @param productId Id of the product
160161 */
161- public void updateProductStatusTimestamp (Status status , Date timestamp , String productId )
162- throws TestGridDAOException {
163- try {
164- String queryStr = "UPDATE product SET " ;
165- if (status .equals (Status .SUCCESS )) {
166- queryStr += "last_success_timestamp = " ;
167- } else if (status .equals (Status .FAIL )) {
168- queryStr += "last_failure_timestamp = " ;
169- }
170- queryStr += "'" + timestamp + "' where id = '" + productId + "';" ;
171-
172- // Begin entity manager transaction
173- entityManager .getTransaction ().begin ();
174-
175- entityManager .createNativeQuery (queryStr ).executeUpdate ();
176-
177- // Commit transaction
178- entityManager .getTransaction ().commit ();
179- } catch (Exception e ) {
180- throw new TestGridDAOException ("Error on executing the native SQL query to update product table." , e );
162+ public void updateProductStatusTimestamp (Status status , Date timestamp , String productId ) {
163+ String queryStr = "UPDATE product SET " ;
164+ if (status .equals (Status .SUCCESS )) {
165+ queryStr += "last_success_timestamp = " ;
166+ } else if (status .equals (Status .FAIL )) {
167+ queryStr += "last_failure_timestamp = " ;
181168 }
169+
170+ // Begin entity manager transaction
171+ entityManager .getTransaction ().begin ();
172+ entityManager .createNativeQuery (
173+ StringUtil .concatStrings (queryStr , "'" , timestamp , "' where id = '" , productId , "';" )).executeUpdate ();
174+ // Commit transaction
175+ entityManager .getTransaction ().commit ();
182176 }
183177}
0 commit comments