mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-15 20:35:49 +00:00
Add some javadoc
This commit is contained in:
parent
818529b5b1
commit
fb64465802
2 changed files with 10 additions and 2 deletions
|
@ -16,11 +16,16 @@
|
||||||
package org.springframework.samples.petclinic.repository.jdbc;
|
package org.springframework.samples.petclinic.repository.jdbc;
|
||||||
|
|
||||||
import org.springframework.data.jdbc.core.OneToManyResultSetExtractor;
|
import org.springframework.data.jdbc.core.OneToManyResultSetExtractor;
|
||||||
|
import org.springframework.jdbc.core.ResultSetExtractor;
|
||||||
import org.springframework.samples.petclinic.model.Visit;
|
import org.springframework.samples.petclinic.model.Visit;
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@link ResultSetExtractor} implementation by using the
|
||||||
|
* {@link OneToManyResultSetExtractor} of Spring Data Core JDBC Extensions.
|
||||||
|
*/
|
||||||
public class JdbcPetVisitExtractor extends
|
public class JdbcPetVisitExtractor extends
|
||||||
OneToManyResultSetExtractor<JdbcPet, Visit, Integer> {
|
OneToManyResultSetExtractor<JdbcPet, Visit, Integer> {
|
||||||
|
|
||||||
|
@ -37,8 +42,7 @@ public class JdbcPetVisitExtractor extends
|
||||||
protected Integer mapForeignKey(ResultSet rs) throws SQLException {
|
protected Integer mapForeignKey(ResultSet rs) throws SQLException {
|
||||||
if (rs.getObject("visits.pet_id") == null) {
|
if (rs.getObject("visits.pet_id") == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return rs.getInt("visits.pet_id");
|
return rs.getInt("visits.pet_id");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,10 @@ import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@link RowMapper} implementation mapping data from a {@link ResultSet} to the corresponding properties
|
||||||
|
* of the {@link Visit} class.
|
||||||
|
*/
|
||||||
class JdbcVisitRowMapper implements RowMapper<Visit> {
|
class JdbcVisitRowMapper implements RowMapper<Visit> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue