|
15 | 15 | */
|
16 | 16 | package org.springframework.data.jdbc.core;
|
17 | 17 |
|
18 |
| -import java.util.Map; |
19 |
| - |
20 |
| -import org.springframework.data.mapping.PersistentPropertyPath; |
21 |
| -import org.springframework.data.relational.core.mapping.RelationalPersistentProperty; |
22 |
| -import org.springframework.data.relational.domain.Identifier; |
23 |
| -import org.springframework.lang.Nullable; |
24 |
| - |
25 | 18 | /**
|
26 | 19 | * Abstraction for accesses to the database that should be implementable with a single SQL statement per method and
|
27 | 20 | * relates to a single entity as opposed to {@link JdbcAggregateOperations} which provides interactions related to
|
28 | 21 | * complete aggregates.
|
29 | 22 | *
|
30 | 23 | * @author Jens Schauder
|
| 24 | + * @author Mark Paluch |
| 25 | + * @deprecated since 1.1, use {@link org.springframework.data.jdbc.core.convert.DataAccessStrategy} |
31 | 26 | */
|
32 |
| -public interface DataAccessStrategy { |
33 |
| - |
34 |
| - /** |
35 |
| - * Inserts a the data of a single entity. Referenced entities don't get handled. |
36 |
| - * |
37 |
| - * @param instance the instance to be stored. Must not be {@code null}. |
38 |
| - * @param domainType the type of the instance. Must not be {@code null}. |
39 |
| - * @param additionalParameters name-value pairs of additional parameters. Especially ids of parent entities that need |
40 |
| - * to get referenced are contained in this map. Must not be {@code null}. |
41 |
| - * @param <T> the type of the instance. |
42 |
| - * @return the id generated by the database if any. |
43 |
| - * @deprecated since 1.1, use {@link #insert(Object, Class, Identifier)} instead. |
44 |
| - */ |
45 |
| - @Deprecated |
46 |
| - <T> Object insert(T instance, Class<T> domainType, Map<String, Object> additionalParameters); |
47 |
| - |
48 |
| - /** |
49 |
| - * Inserts a the data of a single entity. Referenced entities don't get handled. |
50 |
| - * |
51 |
| - * @param instance the instance to be stored. Must not be {@code null}. |
52 |
| - * @param domainType the type of the instance. Must not be {@code null}. |
53 |
| - * @param identifier information about data that needs to be considered for the insert but which is not part of the |
54 |
| - * entity. Namely references back to a parent entity and key/index columns for entities that are stored in a |
55 |
| - * {@link Map} or {@link java.util.List}. |
56 |
| - * @param <T> the type of the instance. |
57 |
| - * @return the id generated by the database if any. |
58 |
| - * @since 1.1 |
59 |
| - */ |
60 |
| - default <T> Object insert(T instance, Class<T> domainType, Identifier identifier){ |
61 |
| - return insert(instance, domainType, identifier.toMap()); |
62 |
| - } |
63 |
| - |
64 |
| - /** |
65 |
| - * Updates the data of a single entity in the database. Referenced entities don't get handled. |
66 |
| - * |
67 |
| - * @param instance the instance to save. Must not be {@code null}. |
68 |
| - * @param domainType the type of the instance to save. Must not be {@code null}. |
69 |
| - * @param <T> the type of the instance to save. |
70 |
| - * @return whether the update actually updated a row. |
71 |
| - */ |
72 |
| - <T> boolean update(T instance, Class<T> domainType); |
73 |
| - |
74 |
| - /** |
75 |
| - * deletes a single row identified by the id, from the table identified by the domainType. Does not handle cascading |
76 |
| - * deletes. |
77 |
| - * |
78 |
| - * @param id the id of the row to be deleted. Must not be {@code null}. |
79 |
| - * @param domainType the type of entity to be deleted. Implicitly determines the table to operate on. Must not be |
80 |
| - * {@code null}. |
81 |
| - */ |
82 |
| - void delete(Object id, Class<?> domainType); |
83 |
| - |
84 |
| - /** |
85 |
| - * Deletes all entities reachable via {@literal propertyPath} from the instance identified by {@literal rootId}. |
86 |
| - * |
87 |
| - * @param rootId Id of the root object on which the {@literal propertyPath} is based. Must not be {@code null}. |
88 |
| - * @param propertyPath Leading from the root object to the entities to be deleted. Must not be {@code null}. |
89 |
| - */ |
90 |
| - void delete(Object rootId, PersistentPropertyPath<RelationalPersistentProperty> propertyPath); |
91 |
| - |
92 |
| - /** |
93 |
| - * Deletes all entities of the given domain type. |
94 |
| - * |
95 |
| - * @param domainType the domain type for which to delete all entries. Must not be {@code null}. |
96 |
| - * @param <T> type of the domain type. |
97 |
| - */ |
98 |
| - <T> void deleteAll(Class<T> domainType); |
99 |
| - |
100 |
| - /** |
101 |
| - * Deletes all entities reachable via {@literal propertyPath} from any instance. |
102 |
| - * |
103 |
| - * @param propertyPath Leading from the root object to the entities to be deleted. Must not be {@code null}. |
104 |
| - */ |
105 |
| - void deleteAll(PersistentPropertyPath<RelationalPersistentProperty> propertyPath); |
106 |
| - |
107 |
| - /** |
108 |
| - * Counts the rows in the table representing the given domain type. |
109 |
| - * |
110 |
| - * @param domainType the domain type for which to count the elements. Must not be {@code null}. |
111 |
| - * @return the count. Guaranteed to be not {@code null}. |
112 |
| - */ |
113 |
| - long count(Class<?> domainType); |
114 |
| - |
115 |
| - /** |
116 |
| - * Loads a single entity identified by type and id. |
117 |
| - * |
118 |
| - * @param id the id of the entity to load. Must not be {@code null}. |
119 |
| - * @param domainType the domain type of the entity. Must not be {@code null}. |
120 |
| - * @param <T> the type of the entity. |
121 |
| - * @return Might return {@code null}. |
122 |
| - */ |
123 |
| - @Nullable |
124 |
| - <T> T findById(Object id, Class<T> domainType); |
125 |
| - |
126 |
| - /** |
127 |
| - * Loads all entities of the given type. |
128 |
| - * |
129 |
| - * @param domainType the type of entities to load. Must not be {@code null}. |
130 |
| - * @param <T> the type of entities to load. |
131 |
| - * @return Guaranteed to be not {@code null}. |
132 |
| - */ |
133 |
| - <T> Iterable<T> findAll(Class<T> domainType); |
134 |
| - |
135 |
| - /** |
136 |
| - * Loads all entities that match one of the ids passed as an argument. It is not guaranteed that the number of ids |
137 |
| - * passed in matches the number of entities returned. |
138 |
| - * |
139 |
| - * @param ids the Ids of the entities to load. Must not be {@code null}. |
140 |
| - * @param domainType the type of entities to laod. Must not be {@code null}. |
141 |
| - * @param <T> type of entities to load. |
142 |
| - * @return the loaded entities. Guaranteed to be not {@code null}. |
143 |
| - */ |
144 |
| - <T> Iterable<T> findAllById(Iterable<?> ids, Class<T> domainType); |
145 |
| - |
146 |
| - /** |
147 |
| - * Finds all entities reachable via {@literal property} from the instance identified by {@literal rootId}. |
148 |
| - * |
149 |
| - * @param rootId Id of the root object on which the {@literal propertyPath} is based. |
150 |
| - * @param property Leading from the root object to the entities to be found. |
151 |
| - */ |
152 |
| - <T> Iterable<T> findAllByProperty(Object rootId, RelationalPersistentProperty property); |
153 |
| - |
154 |
| - /** |
155 |
| - * returns if a row with the given id exists for the given type. |
156 |
| - * |
157 |
| - * @param id the id of the entity for which to check. Must not be {@code null}. |
158 |
| - * @param domainType the type of the entity to check for. Must not be {@code null}. |
159 |
| - * @param <T> the type of the entity. |
160 |
| - * @return {@code true} if a matching row exists, otherwise {@code false}. |
161 |
| - */ |
162 |
| - <T> boolean existsById(Object id, Class<T> domainType); |
163 |
| -} |
| 27 | +@Deprecated |
| 28 | +public interface DataAccessStrategy extends org.springframework.data.jdbc.core.convert.DataAccessStrategy {} |
0 commit comments