@@ -293,12 +293,12 @@ public static List<Pet> findAllSilent() {
293
293
* @param nmPet
294
294
* @param numAge
295
295
*
296
- * @return the unique result of Pet found
296
+ * @return the list of Pet results found
297
297
*
298
298
* @throws H2ZeroFinderException if no results could be found
299
299
* @throws SQLException if there was an error in the SQL statement
300
300
*/
301
- public static Pet findByNmPetNumAge (Connection connection , String nmPet , Integer numAge , Integer limit , Integer offset ) throws H2ZeroFinderException , SQLException {
301
+ public static List < Pet > findByNmPetNumAge (Connection connection , String nmPet , Integer numAge , Integer limit , Integer offset ) throws H2ZeroFinderException , SQLException {
302
302
boolean hasConnection = (null != connection );
303
303
String statement = null ;
304
304
@@ -328,7 +328,7 @@ public static Pet findByNmPetNumAge(Connection connection, String nmPet, Integer
328
328
329
329
PreparedStatement preparedStatement = null ;
330
330
ResultSet resultSet = null ;
331
- Pet result = null ;
331
+ List < Pet > results = null ;
332
332
try {
333
333
if (!hasConnection ) {
334
334
connection = ConnectionManager .getConnection ();
@@ -338,12 +338,9 @@ public static Pet findByNmPetNumAge(Connection connection, String nmPet, Integer
338
338
ConnectionManager .setInt (preparedStatement , 2 , numAge );
339
339
340
340
resultSet = preparedStatement .executeQuery ();
341
- result = uniqueResult (resultSet );
342
- ConnectionManager .closeAll (resultSet , preparedStatement );
341
+ results = list (resultSet );
343
342
} catch (SQLException sqlex ) {
344
343
throw sqlex ;
345
- } catch (H2ZeroFinderException h2zfex ) {
346
- throw new H2ZeroFinderException (h2zfex .getMessage () + " Additionally, the parameters were " + "[nmPet:" + nmPet + "], " + "[numAge:" + numAge + "]." );
347
344
} finally {
348
345
if (hasConnection ) {
349
346
ConnectionManager .closeAll (resultSet , preparedStatement , null );
@@ -353,26 +350,26 @@ public static Pet findByNmPetNumAge(Connection connection, String nmPet, Integer
353
350
}
354
351
355
352
356
- if (null == result ) {
353
+ if (null == results ) {
357
354
throw new H2ZeroFinderException ("Could not find result." );
358
355
}
359
- return (result );
356
+ return (results );
360
357
}
361
358
362
- public static Pet findByNmPetNumAge (Connection connection , String nmPet , Integer numAge ) throws H2ZeroFinderException , SQLException {
359
+ public static List < Pet > findByNmPetNumAge (Connection connection , String nmPet , Integer numAge ) throws H2ZeroFinderException , SQLException {
363
360
return (findByNmPetNumAge (connection , nmPet , numAge , null , null ));
364
361
}
365
362
366
- public static Pet findByNmPetNumAge (String nmPet , Integer numAge , Integer limit , Integer offset ) throws H2ZeroFinderException , SQLException {
363
+ public static List < Pet > findByNmPetNumAge (String nmPet , Integer numAge , Integer limit , Integer offset ) throws H2ZeroFinderException , SQLException {
367
364
return (findByNmPetNumAge (null , nmPet , numAge , limit , offset ));
368
365
}
369
366
370
- public static Pet findByNmPetNumAge (String nmPet , Integer numAge ) throws H2ZeroFinderException , SQLException {
367
+ public static List < Pet > findByNmPetNumAge (String nmPet , Integer numAge ) throws H2ZeroFinderException , SQLException {
371
368
return (findByNmPetNumAge (null , nmPet , numAge , null , null ));
372
369
}
373
370
374
371
// silent connection, params..., limit, offset
375
- public static Pet findByNmPetNumAgeSilent (Connection connection , String nmPet , Integer numAge , Integer limit , Integer offset ) {
372
+ public static List < Pet > findByNmPetNumAgeSilent (Connection connection , String nmPet , Integer numAge , Integer limit , Integer offset ) {
376
373
try {
377
374
return (findByNmPetNumAge (connection , nmPet , numAge , limit , offset ));
378
375
} catch (H2ZeroFinderException h2zfex ) {
@@ -382,29 +379,29 @@ public static Pet findByNmPetNumAgeSilent(Connection connection, String nmPet, I
382
379
h2zfex .printStackTrace ();
383
380
}
384
381
}
385
- return (null );
382
+ return (new ArrayList < Pet >() );
386
383
} catch (SQLException sqlex ) {
387
384
if (LOGGER .isWarnEnabled ()) {
388
385
LOGGER .warn ("SQLException findByNmPetNumAgeSilent(connection: " + connection + ", " + nmPet + ", " + numAge + ", limit: " + limit + ", offset: " + offset + "): " + sqlex .getMessage ());
389
386
if (LOGGER .isDebugEnabled ()) {
390
387
sqlex .printStackTrace ();
391
388
}
392
389
}
393
- return (null );
390
+ return (new ArrayList < Pet >() );
394
391
}
395
392
}
396
393
397
394
// silent connection, params...
398
- public static Pet findByNmPetNumAgeSilent (Connection connection , String nmPet , Integer numAge ) {
395
+ public static List < Pet > findByNmPetNumAgeSilent (Connection connection , String nmPet , Integer numAge ) {
399
396
return (findByNmPetNumAgeSilent (connection , nmPet , numAge , null , null ));
400
397
}
401
398
402
399
// silent params..., limit, offset
403
- public static Pet findByNmPetNumAgeSilent (String nmPet , Integer numAge , Integer limit , Integer offset ) {
400
+ public static List < Pet > findByNmPetNumAgeSilent (String nmPet , Integer numAge , Integer limit , Integer offset ) {
404
401
return (findByNmPetNumAgeSilent (null , nmPet , numAge , limit , offset ));
405
402
}
406
403
407
- public static Pet findByNmPetNumAgeSilent (String nmPet , Integer numAge ) {
404
+ public static List < Pet > findByNmPetNumAgeSilent (String nmPet , Integer numAge ) {
408
405
return (findByNmPetNumAgeSilent (null , nmPet , numAge , null , null ));
409
406
}
410
407
0 commit comments