Skip to content

DATAJDBC-480 - Removed usage of deprecated EntityInstantiators and EntityInstantiator. #204

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
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>2.0.0.BUILD-SNAPSHOT</version>
<version>2.0.0.DATAJDBC-480-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>2.0.0.BUILD-SNAPSHOT</version>
<version>2.0.0.DATAJDBC-480-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 @@ -6,7 +6,7 @@
<modelVersion>4.0.0</modelVersion>

<artifactId>spring-data-jdbc</artifactId>
<version>2.0.0.BUILD-SNAPSHOT</version>
<version>2.0.0.DATAJDBC-480-SNAPSHOT</version>

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

<properties>
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,13 @@

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.function.Consumer;
import java.util.function.Function;

import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.mapping.PersistentPropertyPath;
import org.springframework.data.relational.core.mapping.RelationalPersistentProperty;
import org.springframework.data.relational.core.sql.SqlIdentifier;
import org.springframework.data.relational.domain.Identifier;

/**
Expand All @@ -46,15 +44,6 @@ public CascadingDataAccessStrategy(List<DataAccessStrategy> strategies) {
this.strategies = new ArrayList<>(strategies);
}

/*
* (non-Javadoc)
* @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<SqlIdentifier, Object> additionalParameters) {
return collect(das -> das.insert(instance, domainType, additionalParameters));
}

/*
* (non-Javadoc)
* @see org.springframework.data.jdbc.core.DataAccessStrategy#insert(java.lang.Object, java.lang.Class, org.springframework.data.jdbc.core.ParentKeys)
Expand Down Expand Up @@ -173,15 +162,6 @@ public Iterable<Object> findAllByPath(Identifier identifier,
return collect(das -> das.findAllByPath(identifier, path));
}

/*
* (non-Javadoc)
* @see org.springframework.data.jdbc.core.DataAccessStrategy#findAllByProperty(java.lang.Object, org.springframework.data.relational.core.mapping.RelationalPersistentProperty)
*/
@Override
public <T> Iterable<T> findAllByProperty(Object rootId, RelationalPersistentProperty property) {
return collect(das -> das.findAllByProperty(rootId, property));
}

/*
* (non-Javadoc)
* @see org.springframework.data.jdbc.core.DataAccessStrategy#existsById(java.lang.Object, java.lang.Class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import org.springframework.data.jdbc.core.JdbcAggregateOperations;
import org.springframework.data.mapping.PersistentPropertyPath;
import org.springframework.data.relational.core.mapping.RelationalPersistentProperty;
import org.springframework.data.relational.core.sql.SqlIdentifier;
import org.springframework.data.relational.domain.Identifier;
import org.springframework.lang.Nullable;

Expand All @@ -38,21 +37,6 @@
*/
public interface DataAccessStrategy extends RelationResolver {

/**
* Inserts a the data of a single entity. Referenced entities don't get handled.
*
* @param instance the instance to be stored. Must not be {@code null}.
* @param domainType the type of the instance. Must not be {@code null}.
* @param additionalParameters name-value pairs of additional parameters. Especially ids of parent entities that need
* to get referenced are contained in this map. Must not be {@code null}.
* @param <T> the type of the instance.
* @return the id generated by the database if any.
* @deprecated since 1.1, use {@link #insert(Object, Class, Identifier)} instead.
*/
@Deprecated
@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 All @@ -66,9 +50,7 @@ public interface DataAccessStrategy extends RelationResolver {
* @since 1.1
*/
@Nullable
default <T> Object insert(T instance, Class<T> domainType, Identifier identifier) {
return insert(instance, domainType, identifier.toMap());
}
<T> Object insert(T instance, Class<T> domainType, Identifier identifier);

/**
* Updates the data of a single entity in the database. Referenced entities don't get handled.
Expand Down Expand Up @@ -192,22 +174,8 @@ default <T> Object insert(T instance, Class<T> domainType, Identifier identifier
* @see org.springframework.data.jdbc.core.RelationResolver#findAllByPath(org.springframework.data.relational.domain.Identifier, org.springframework.data.mapping.PersistentPropertyPath)
*/
@Override
default Iterable<Object> findAllByPath(Identifier identifier,
PersistentPropertyPath<? extends RelationalPersistentProperty> path) {

Object rootId = identifier.toMap().get(path.getRequiredLeafProperty().getReverseColumnName());
return findAllByProperty(rootId, path.getRequiredLeafProperty());
}

/**
* Finds all entities reachable via {@literal property} from the instance identified by {@literal rootId}.
*
* @param rootId Id of the root object on which the {@literal propertyPath} is based.
* @param property Leading from the root object to the entities to be found.
* @deprecated Use #findAllByPath instead.
*/
@Deprecated
<T> Iterable<T> findAllByProperty(Object rootId, RelationalPersistentProperty property);
Iterable<Object> findAllByPath(Identifier identifier,
PersistentPropertyPath<? extends RelationalPersistentProperty> path);

/**
* returns if a row with the given id exists for the given type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,16 +95,6 @@ public DefaultDataAccessStrategy(SqlGeneratorSource sqlGeneratorSource, Relation
this.operations = operations;
}

/*
* (non-Javadoc)
* @see org.springframework.data.jdbc.core.DataAccessStrategy#insert(java.lang.Object, java.lang.Class, java.util.Map)
*/
@Override
@Nullable
public <T> Object insert(T instance, Class<T> domainType, Map<SqlIdentifier, Object> additionalParameters) {
return insert(instance, domainType, Identifier.from(additionalParameters));
}

/*
* (non-Javadoc)
* @see org.springframework.data.jdbc.core.DataAccessStrategy#insert(java.lang.Object, java.lang.Class, java.util.Map)
Expand Down Expand Up @@ -346,21 +336,6 @@ private SqlParameterSource createParameterSource(Identifier identifier, Identifi
return parameterSource;
}

/*
* (non-Javadoc)
* @see org.springframework.data.jdbc.core.DataAccessStrategy#findAllByProperty(java.lang.Object, org.springframework.data.jdbc.mapping.model.JdbcPersistentProperty)
*/
@Override
@SuppressWarnings("unchecked")
public Iterable<Object> findAllByProperty(Object rootId, RelationalPersistentProperty property) {

Assert.notNull(rootId, "rootId must not be null.");

Class<?> rootType = property.getOwner().getType();
return findAllByPath(Identifier.of(property.getReverseColumnName(), rootId, rootType),
context.getPersistentPropertyPath(property.getName(), rootType));
}

/*
* (non-Javadoc)
* @see org.springframework.data.jdbc.core.DataAccessStrategy#existsById(java.lang.Object, java.lang.Class)
Expand Down
Loading