Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>org.springframework.data</groupId>
<artifactId>spring-data-relational-parent</artifactId>
<version>1.2.0.BUILD-SNAPSHOT</version>
<version>1.2.0.DATAJDBC-386-SNAPSHOT</version>
<packaging>pom</packaging>

<name>Spring Data Relational Parent</name>
Expand Down
2 changes: 1 addition & 1 deletion spring-data-jdbc-distribution/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<parent>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-relational-parent</artifactId>
<version>1.2.0.BUILD-SNAPSHOT</version>
<version>1.2.0.DATAJDBC-386-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
4 changes: 2 additions & 2 deletions spring-data-jdbc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>

<artifactId>spring-data-jdbc</artifactId>
<version>1.2.0.BUILD-SNAPSHOT</version>
<version>1.2.0.DATAJDBC-386-SNAPSHOT</version>

<name>Spring Data JDBC</name>
<description>Spring Data module for JDBC repositories.</description>
Expand All @@ -14,7 +14,7 @@
<parent>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-relational-parent</artifactId>
<version>1.2.0.BUILD-SNAPSHOT</version>
<version>1.2.0.DATAJDBC-386-SNAPSHOT</version>
</parent>

<properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ private Object getIdFrom(DbAction.WithEntity<?> idOwningAction) {
.getRequiredPersistentEntity(idOwningAction.getEntityType());
Object identifier = persistentEntity.getIdentifierAccessor(idOwningAction.getEntity()).getIdentifier();

Assert.state(identifier != null, "Couldn't get obtain a required id value");
Assert.state(identifier != null, "Couldn't obtain a required id value");

return identifier;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,14 @@
import org.springframework.data.mapping.model.SimpleTypeHolder;
import org.springframework.data.relational.core.conversion.BasicRelationalConverter;
import org.springframework.data.relational.core.conversion.RelationalConverter;
import org.springframework.data.relational.core.dialect.HsqlDbDialect;
import org.springframework.data.relational.core.mapping.Embedded;
import org.springframework.data.relational.core.mapping.Embedded.OnEmpty;
import org.springframework.data.relational.core.mapping.PersistentPropertyPathExtension;
import org.springframework.data.relational.core.mapping.RelationalPersistentEntity;
import org.springframework.data.relational.core.mapping.RelationalPersistentProperty;
import org.springframework.data.relational.domain.Identifier;
import org.springframework.data.relational.domain.IdentifierProcessing;
import org.springframework.data.util.ClassTypeInformation;
import org.springframework.data.util.TypeInformation;
import org.springframework.lang.Nullable;
Expand All @@ -69,6 +71,7 @@ public class BasicJdbcConverter extends BasicRelationalConverter implements Jdbc
private static final Converter<Iterable<?>, Map<?, ?>> ITERABLE_OF_ENTRY_TO_MAP_CONVERTER = new IterableOfEntryToMapConverter();

private final JdbcTypeFactory typeFactory;
private final IdentifierProcessing identifierProcessing = HsqlDbDialect.INSTANCE.getIdentifierProcessing();

private RelationResolver relationResolver;

Expand Down Expand Up @@ -374,7 +377,8 @@ private Object readFrom(RelationalPersistentProperty property) {
return readEntityFrom(property, path);
}

Object value = getObjectFromResultSet(path.extendBy(property).getColumnAlias());
Object value = getObjectFromResultSet(
path.extendBy(property).getColumnAlias().getReference(identifierProcessing));
return readValue(value, property.getTypeInformation());
}

Expand Down Expand Up @@ -428,7 +432,8 @@ private Object readEntityFrom(RelationalPersistentProperty property, PersistentP
if (idProperty != null) {
idValue = newContext.readFrom(idProperty);
} else {
idValue = newContext.getObjectFromResultSet(path.extendBy(property).getReverseColumnNameAlias());
idValue = newContext.getObjectFromResultSet(
path.extendBy(property).getReverseColumnNameAlias().getReference(identifierProcessing));
}

if (idValue == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.springframework.data.mapping.PersistentPropertyPath;
import org.springframework.data.relational.core.mapping.RelationalPersistentProperty;
import org.springframework.data.relational.domain.Identifier;
import org.springframework.data.relational.domain.SqlIdentifier;

/**
* Delegates each methods to the {@link DataAccessStrategy}s passed to the constructor in turn until the first that does
Expand All @@ -47,7 +48,7 @@ public CascadingDataAccessStrategy(List<DataAccessStrategy> strategies) {
* @see org.springframework.data.jdbc.core.DataAccessStrategy#insert(java.lang.Object, java.lang.Class, java.util.Map)
*/
@Override
public <T> Object insert(T instance, Class<T> domainType, Map<String, Object> additionalParameters) {
public <T> Object insert(T instance, Class<T> domainType, Map<SqlIdentifier, Object> additionalParameters) {
return collect(das -> das.insert(instance, domainType, additionalParameters));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.springframework.data.mapping.PersistentPropertyPath;
import org.springframework.data.relational.core.mapping.RelationalPersistentProperty;
import org.springframework.data.relational.domain.Identifier;
import org.springframework.data.relational.domain.SqlIdentifier;
import org.springframework.lang.Nullable;

/**
Expand All @@ -46,7 +47,8 @@ public interface DataAccessStrategy extends RelationResolver {
* @deprecated since 1.1, use {@link #insert(Object, Class, Identifier)} instead.
*/
@Deprecated
<T> Object insert(T instance, Class<T> domainType, Map<String, Object> additionalParameters);
@Nullable
<T> Object insert(T instance, Class<T> domainType, Map<SqlIdentifier, Object> additionalParameters);

/**
* Inserts a the data of a single entity. Referenced entities don't get handled.
Expand Down Expand Up @@ -76,8 +78,8 @@ default <T> Object insert(T instance, Class<T> domainType, Identifier identifier
<T> boolean update(T instance, Class<T> domainType);

/**
* Updates the data of a single entity in the database and enforce optimistic record locking using the {@code previousVersion}
* property. Referenced entities don't get handled.
* Updates the data of a single entity in the database and enforce optimistic record locking using the
* {@code previousVersion} property. Referenced entities don't get handled.
* <P>
* The statement will be of the form : {@code UPDATE … SET … WHERE ID = :id and VERSION_COLUMN = :previousVersion }
* and throw an optimistic record locking exception if no rows have been updated.
Expand All @@ -87,7 +89,8 @@ default <T> Object insert(T instance, Class<T> domainType, Identifier identifier
* @param previousVersion The previous version assigned to the instance being saved.
* @param <T> the type of the instance to save.
* @return whether the update actually updated a row.
* @throws OptimisticLockingFailureException if the update fails to update at least one row assuming the the optimistic locking version check failed.
* @throws OptimisticLockingFailureException if the update fails to update at least one row assuming the the
* optimistic locking version check failed.
* @since 2.0
*/
<T> boolean updateWithVersion(T instance, Class<T> domainType, Number previousVersion);
Expand All @@ -113,7 +116,8 @@ default <T> Object insert(T instance, Class<T> domainType, Identifier identifier
* @param domainType the type of entity to be deleted. Implicitly determines the table to operate on. Must not be
* {@code null}.
* @param previousVersion The previous version assigned to the instance being saved.
* @throws OptimisticLockingFailureException if the update fails to update at least one row assuming the the optimistic locking version check failed.
* @throws OptimisticLockingFailureException if the update fails to update at least one row assuming the the
* optimistic locking version check failed.
* @since 2.0
*/
<T> void deleteWithVersion(Object id, Class<T> domainType, Number previousVersion);
Expand Down
Loading