DATAJDBC-506 - Fix some typos in code and documentation.
Original pull request: #200.
This commit is contained in:
committed by
Jens Schauder
parent
7a039d7e34
commit
ba348db81d
2
CI.adoc
2
CI.adoc
@@ -8,7 +8,7 @@ image:https://jenkins.spring.io/buildStatus/icon?job=spring-data-jdbc%2F1.0.x&su
|
||||
Since this pipeline is purely Docker-based, it's easy to:
|
||||
|
||||
* Debug what went wrong on your local machine.
|
||||
* Test out a a tweak to your `test.sh` script before sending it out.
|
||||
* Test out a tweak to your `test.sh` script before sending it out.
|
||||
* Experiment against a new image before submitting your pull request.
|
||||
|
||||
All of these use cases are great reasons to essentially run what the CI server does on your local machine.
|
||||
|
||||
@@ -139,7 +139,7 @@ public interface DataAccessStrategy extends RelationResolver {
|
||||
* passed in matches the number of entities returned.
|
||||
*
|
||||
* @param ids the Ids of the entities to load. Must not be {@code null}.
|
||||
* @param domainType the type of entities to laod. Must not be {@code null}.
|
||||
* @param domainType the type of entities to load. Must not be {@code null}.
|
||||
* @param <T> type of entities to load.
|
||||
* @return the loaded entities. Guaranteed to be not {@code null}.
|
||||
*/
|
||||
|
||||
@@ -54,7 +54,7 @@ class IterableOfEntryToMapConverter implements ConditionalConverter, Converter<I
|
||||
|
||||
/**
|
||||
* Tries to determine if the {@literal sourceType} can be converted to a {@link Map}. If this can not be determined,
|
||||
* because the sourceTyppe does not contain information about the element type it returns {@literal true}.
|
||||
* because the sourceType does not contain information about the element type it returns {@literal true}.
|
||||
*
|
||||
* @param sourceType {@link TypeDescriptor} to convert from.
|
||||
* @param targetType {@link TypeDescriptor} to convert to.
|
||||
|
||||
@@ -35,16 +35,16 @@ public class MyBatisContext {
|
||||
private final @Nullable Object instance;
|
||||
private final @Nullable Identifier identifier;
|
||||
private final @Nullable Class domainType;
|
||||
private final Map<String, Object> additonalValues;
|
||||
private final Map<String, Object> additionalValues;
|
||||
|
||||
public MyBatisContext(@Nullable Object id, @Nullable Object instance, @Nullable Class domainType,
|
||||
Map<String, Object> additonalValues) {
|
||||
Map<String, Object> additionalValues) {
|
||||
|
||||
this.id = id;
|
||||
this.identifier = null;
|
||||
this.instance = instance;
|
||||
this.domainType = domainType;
|
||||
this.additonalValues = additonalValues;
|
||||
this.additionalValues = additionalValues;
|
||||
}
|
||||
|
||||
public MyBatisContext(Identifier identifier, @Nullable Object instance, @Nullable Class<?> domainType) {
|
||||
@@ -53,7 +53,7 @@ public class MyBatisContext {
|
||||
this.identifier = identifier;
|
||||
this.instance = instance;
|
||||
this.domainType = domainType;
|
||||
this.additonalValues = Collections.emptyMap();
|
||||
this.additionalValues = Collections.emptyMap();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -104,7 +104,7 @@ public class MyBatisContext {
|
||||
*/
|
||||
@Nullable
|
||||
public Object get(String key) {
|
||||
return additonalValues.get(key);
|
||||
return additionalValues.get(key);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ public class ConfigurableRowMapperMap implements RowMapperMap {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returs a {@link RowMapper} for the given type if such a {@link RowMapper} is present. If an exact match is found
|
||||
* Returns a {@link RowMapper} for the given type if such a {@link RowMapper} is present. If an exact match is found
|
||||
* that is returned. If not a {@link RowMapper} is returned that produces subtypes of the requested type. If no such
|
||||
* {@link RowMapper} is found the method returns {@code null}.
|
||||
*
|
||||
|
||||
@@ -88,7 +88,7 @@ public class JdbcAggregateTemplateUnitTests {
|
||||
}
|
||||
|
||||
@Test // DATAJDBC-378
|
||||
public void findAllByIdWithEmpthListMustReturnEmptyResult() {
|
||||
public void findAllByIdWithEmptyListMustReturnEmptyResult() {
|
||||
assertThat(template.findAllById(emptyList(), SampleEntity.class)).isEmpty();
|
||||
}
|
||||
|
||||
|
||||
@@ -88,19 +88,19 @@ public class JdbcRepositoryResultSetExtractorIntegrationTests {
|
||||
|
||||
// NOT saving anything, so DB is empty
|
||||
|
||||
assertThat(personRepository.findAllPeopleWithAdresses()).isEmpty();
|
||||
assertThat(personRepository.findAllPeopleWithAddresses()).isEmpty();
|
||||
}
|
||||
|
||||
@Test // DATAJDBC-290
|
||||
public void findAllPeopleWithAdressesReturnsOnePersonWithoutAdresses() {
|
||||
public void findAllPeopleWithAddressesReturnsOnePersonWithoutAddresses() {
|
||||
|
||||
personRepository.save(new Person(null, "Joe", null));
|
||||
|
||||
assertThat(personRepository.findAllPeopleWithAdresses()).hasSize(1);
|
||||
assertThat(personRepository.findAllPeopleWithAddresses()).hasSize(1);
|
||||
}
|
||||
|
||||
@Test // DATAJDBC-290
|
||||
public void findAllPeopleWithAdressesReturnsOnePersonWithAdresses() {
|
||||
public void findAllPeopleWithAddressesReturnsOnePersonWithAddresses() {
|
||||
|
||||
final String personName = "Joe";
|
||||
Person savedPerson = personRepository.save(new Person(null, personName, null));
|
||||
@@ -114,13 +114,13 @@ public class JdbcRepositoryResultSetExtractorIntegrationTests {
|
||||
MapSqlParameterSource paramsAddress2 = buildAddressParameters(savedPerson.getId(), street2);
|
||||
template.update("insert into address (street, person_id) values (:street, :personId)", paramsAddress2);
|
||||
|
||||
List<Person> people = personRepository.findAllPeopleWithAdresses();
|
||||
List<Person> people = personRepository.findAllPeopleWithAddresses();
|
||||
|
||||
assertThat(people).hasSize(1);
|
||||
Person person = people.get(0);
|
||||
assertThat(person.getName()).isEqualTo(personName);
|
||||
assertThat(person.getAdresses()).hasSize(2);
|
||||
assertThat(person.getAdresses()).extracting(a -> a.getStreet()).containsExactlyInAnyOrder(street1, street2);
|
||||
assertThat(person.getAddresses()).hasSize(2);
|
||||
assertThat(person.getAddresses()).extracting(a -> a.getStreet()).containsExactlyInAnyOrder(street1, street2);
|
||||
}
|
||||
|
||||
private MapSqlParameterSource buildAddressParameters(Long id, String streetName) {
|
||||
@@ -137,7 +137,7 @@ public class JdbcRepositoryResultSetExtractorIntegrationTests {
|
||||
@Query(
|
||||
value = "select p.id, p.name, a.id addrId, a.street from person p left join address a on(p.id = a.person_id)",
|
||||
resultSetExtractorClass = PersonResultSetExtractor.class)
|
||||
List<Person> findAllPeopleWithAdresses();
|
||||
List<Person> findAllPeopleWithAddresses();
|
||||
}
|
||||
|
||||
@Data
|
||||
@@ -146,7 +146,7 @@ public class JdbcRepositoryResultSetExtractorIntegrationTests {
|
||||
|
||||
@Id private Long id;
|
||||
private String name;
|
||||
private List<Address> adresses;
|
||||
private List<Address> addresses;
|
||||
}
|
||||
|
||||
@Data
|
||||
@@ -176,13 +176,13 @@ public class JdbcRepositoryResultSetExtractorIntegrationTests {
|
||||
}
|
||||
});
|
||||
|
||||
if (currentPerson.getAdresses() == null) {
|
||||
currentPerson.setAdresses(new ArrayList<>());
|
||||
if (currentPerson.getAddresses() == null) {
|
||||
currentPerson.setAddresses(new ArrayList<>());
|
||||
}
|
||||
|
||||
long addrId = rs.getLong("addrId");
|
||||
if (!rs.wasNull()) {
|
||||
currentPerson.getAdresses().add(new Address(addrId, rs.getString("street")));
|
||||
currentPerson.getAddresses().add(new Address(addrId, rs.getString("street")));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -172,7 +172,7 @@ public class QueryAnnotationHsqlIntegrationTests {
|
||||
}
|
||||
|
||||
@Test // DATAJDBC-175
|
||||
public void executeCustomQueryWithReturnTypeIsNubmer() {
|
||||
public void executeCustomQueryWithReturnTypeIsNumber() {
|
||||
|
||||
repository.save(dummyEntity("aaa"));
|
||||
repository.save(dummyEntity("bbb"));
|
||||
@@ -200,7 +200,7 @@ public class QueryAnnotationHsqlIntegrationTests {
|
||||
public void executeCustomQueryWithReturnTypeIsDate() {
|
||||
|
||||
// Since Timestamp extends Date the repository returns the Timestamp as it comes from the database.
|
||||
// Trying to compare that to an actual Date results in non determistic results, so we have to use an actual
|
||||
// Trying to compare that to an actual Date results in non deterministic results, so we have to use an actual
|
||||
// Timestamp.
|
||||
Date now = new Timestamp(System.currentTimeMillis());
|
||||
assertThat(repository.nowWithDate()).isAfterOrEqualsTo(now);
|
||||
|
||||
@@ -98,7 +98,7 @@ public class JdbcRepositoryFactoryBeanUnitTests {
|
||||
}
|
||||
|
||||
@Test(expected = IllegalStateException.class) // DATAJDBC-155
|
||||
public void afterPropertiesThowsExceptionWhenNoMappingContextSet() {
|
||||
public void afterPropertiesThrowsExceptionWhenNoMappingContextSet() {
|
||||
|
||||
factoryBean.setMappingContext(null);
|
||||
factoryBean.setApplicationEventPublisher(publisher);
|
||||
|
||||
@@ -309,7 +309,7 @@ public class EmbeddedEntity {
|
||||
String name;
|
||||
}
|
||||
----
|
||||
<1> ``Null``s `embeddedEntity` if `name` in `null`. Use `USE_EMPTY` to instanciate `embeddedEntity` with a potential `null` value for the `name` property.
|
||||
<1> ``Null``s `embeddedEntity` if `name` in `null`. Use `USE_EMPTY` to instantiate `embeddedEntity` with a potential `null` value for the `name` property.
|
||||
====
|
||||
|
||||
If you need a value object multiple times in an entity, this can be achieved with the optional `prefix` element of the `@Embedded` annotation.
|
||||
@@ -317,7 +317,7 @@ This element represents a prefix and is prepend for each column name in the embe
|
||||
|
||||
[TIP]
|
||||
====
|
||||
Make use of the shortcuts `@Embedded.Nullable` & `@Embedded.Empty` for `@Embedded(onEmpty = USE_NULL)` and `@Embedded(onEmpty = USE_EMPTY)` to reduce verbositility and simultaneously set JSR-305 `@javax.annotation.Nonnull` accordingly.
|
||||
Make use of the shortcuts `@Embedded.Nullable` & `@Embedded.Empty` for `@Embedded(onEmpty = USE_NULL)` and `@Embedded(onEmpty = USE_EMPTY)` to reduce verbosity and simultaneously set JSR-305 `@javax.annotation.Nonnull` accordingly.
|
||||
|
||||
[source, java]
|
||||
----
|
||||
|
||||
Reference in New Issue
Block a user