16
16
17
17
package com .jmethods .catatumbo ;
18
18
19
+ import java .lang .reflect .Type ;
19
20
import java .util .List ;
20
21
21
22
/**
25
26
* (read/write) within a transaction. Transactions are committed with the call to
26
27
* {@link DatastoreTransaction#commit()} method. Transactions can be rolled back with a call to
27
28
* {@link DatastoreTransaction#rollback()}.
28
- *
29
+ *
29
30
* @author Sai Pullabhotla
30
31
*
31
32
*/
@@ -34,7 +35,7 @@ public interface DatastoreTransaction extends DatastoreAccess {
34
35
/**
35
36
* Inserts the given entity. ID allocation is deferred to the submit time. Generated key, if any,
36
37
* can be retrieved by calling {@link DatastoreTransaction.Response#getGeneratedKeys()}.
37
- *
38
+ *
38
39
* @param entity
39
40
* the entity to insert.
40
41
* @throws EntityManagerException
@@ -43,10 +44,24 @@ public interface DatastoreTransaction extends DatastoreAccess {
43
44
*/
44
45
<E > void insertWithDeferredIdAllocation (E entity );
45
46
47
+ /**
48
+ * Inserts the given entity. ID allocation is deferred to the submit time. Generated key, if any,
49
+ * can be retrieved by calling {@link DatastoreTransaction.Response#getGeneratedKeys()}.
50
+ *
51
+ * @param entity
52
+ * the entity to insert.
53
+ * @param entityType
54
+ * the entity type
55
+ * @throws EntityManagerException
56
+ * if the entity has a String Identifier or any other error occurs while accessing the
57
+ * underlying Datastore.
58
+ */
59
+ <E > void insertWithDeferredIdAllocation (E entity , Type entityType );
60
+
46
61
/**
47
62
* Inserts the given entities. ID allocation is deferred to the submit time. Generated keys, if
48
63
* any, can be retrieved by calling {@link DatastoreTransaction.Response#getGeneratedKeys()}.
49
- *
64
+ *
50
65
* @param entities
51
66
* the entities to insert
52
67
* @throws EntityManagerException
@@ -55,12 +70,26 @@ public interface DatastoreTransaction extends DatastoreAccess {
55
70
*/
56
71
<E > void insertWithDeferredIdAllocation (List <E > entities );
57
72
73
+ /**
74
+ * Inserts the given entities. ID allocation is deferred to the submit time. Generated keys, if
75
+ * any, can be retrieved by calling {@link DatastoreTransaction.Response#getGeneratedKeys()}.
76
+ *
77
+ * @param entities
78
+ * the entities to insert
79
+ * @param entityType
80
+ * the entity type
81
+ * @throws EntityManagerException
82
+ * if the entity has a String Identifier or any other error occurs while accessing the
83
+ * underlying Datastore.
84
+ */
85
+ <E > void insertWithDeferredIdAllocation (List <E > entities , Type entityType );
86
+
58
87
/**
59
88
* Updates or inserts the given entity. ID allocation is deferred to the submit time. Generated
60
89
* key, if any, can be retrieved by calling
61
90
* {@link DatastoreTransaction.Response#getGeneratedKeys()}.
62
- *
63
- *
91
+ *
92
+ *
64
93
* @param entity
65
94
* the entity to update or insert.
66
95
* @throws EntityManagerException
@@ -69,12 +98,28 @@ public interface DatastoreTransaction extends DatastoreAccess {
69
98
*/
70
99
<E > void upsertWithDeferredIdAllocation (E entity );
71
100
101
+ /**
102
+ * Updates or inserts the given entity. ID allocation is deferred to the submit time. Generated
103
+ * key, if any, can be retrieved by calling
104
+ * {@link DatastoreTransaction.Response#getGeneratedKeys()}.
105
+ *
106
+ *
107
+ * @param entity
108
+ * the entity to update or insert.
109
+ * @param entityType
110
+ * the entity type
111
+ * @throws EntityManagerException
112
+ * if the entity has a String Identifier or any other error occurs while accessing the
113
+ * underlying Datastore.
114
+ */
115
+ <E > void upsertWithDeferredIdAllocation (E entity , Type entityType );
116
+
72
117
/**
73
118
* Updates or Inserts the given entities. ID allocation is deferred to the submit time. Generated
74
119
* keys, if any, can be retrieved by calling
75
120
* {@link DatastoreTransaction.Response#getGeneratedKeys()}.
76
- *
77
- *
121
+ *
122
+ *
78
123
* @param entities
79
124
* the entities to update or insert
80
125
* @throws EntityManagerException
@@ -83,27 +128,43 @@ public interface DatastoreTransaction extends DatastoreAccess {
83
128
*/
84
129
<E > void upsertWithDeferredIdAllocation (List <E > entities );
85
130
131
+ /**
132
+ * Updates or Inserts the given entities. ID allocation is deferred to the submit time. Generated
133
+ * keys, if any, can be retrieved by calling
134
+ * {@link DatastoreTransaction.Response#getGeneratedKeys()}.
135
+ *
136
+ *
137
+ * @param entities
138
+ * the entities to update or insert
139
+ * @param entityType
140
+ * the entity type
141
+ * @throws EntityManagerException
142
+ * if the entity has a String Identifier or any other error occurs while accessing the
143
+ * underlying Datastore.
144
+ */
145
+ <E > void upsertWithDeferredIdAllocation (List <E > entities , Type entityType );
146
+
86
147
/**
87
148
* Tells if this DatastoreTransaction is still active.
88
- *
149
+ *
89
150
* @return <code>true</code>, if this DatastoreTransaction is still active; <code>false</code>,
90
151
* otherwise.
91
152
*/
92
153
boolean isActive ();
93
154
94
155
/**
95
156
* Commits changes made within this transaction.
96
- *
157
+ *
97
158
* @return Response. The response contains any generated.
98
- *
159
+ *
99
160
* @throws EntityManagerException
100
161
* if the commit fails.
101
162
*/
102
163
Response commit ();
103
164
104
165
/**
105
166
* Rolls back the changes made in this transaction.
106
- *
167
+ *
107
168
* @throws EntityManagerException
108
169
* if this transaction was already committed.
109
170
*/
@@ -112,14 +173,14 @@ public interface DatastoreTransaction extends DatastoreAccess {
112
173
/**
113
174
* Transaction's commit Response. Used for returning generated keys for entities whose id
114
175
* allocation was deferred until submit/commit time.
115
- *
176
+ *
116
177
* @author Sai Pullabhotla
117
178
*
118
179
*/
119
180
interface Response {
120
181
/**
121
182
* Returns a list of generated keys.
122
- *
183
+ *
123
184
* @return a list of generated keys.
124
185
*/
125
186
List <DatastoreKey > getGeneratedKeys ();
0 commit comments