001: package com.completex.objective.components.persistency;
002:
003: import com.completex.objective.components.persistency.type.TracingCollection;
004:
005: import java.util.Collection;
006:
007: /**
008: * @author Gennady Krizhevsky
009: */
010: public interface LightPersistency extends Persistency0,
011: InsertPersistency, SelectPersistency {
012:
013: /**
014: * Update persistent object. Key values are the ones of primary key and "optimistic lock" fields.
015: *
016: * @param persistentObject object to update
017: * @return number of row affected or RC_NON_DIRTY value if record is not "dirty". Should not be used for batch updates or complex/compound objects
018: * @throws OdalPersistencyException
019: *
020: */
021: int update(PersistentObject persistentObject)
022: throws OdalPersistencyException;
023:
024: /**
025: * Update persistent object. Key values are the ones of primary key and "optimistic lock" fields.
026: *
027: * @param persistentObject object to update
028: * @return number of row affected or RC_NON_DIRTY value if record is not "dirty". Should not be used for batch updates or complex/compound objects
029: * @throws OdalPersistencyException
030: *
031: */
032: int update(PersistentObject persistentObject, String extraWhere,
033: Parameters extraParameters) throws OdalPersistencyException;
034:
035: /**
036: * Update persistent object. Key values are the ones of primary key and "optimistic lock" fields.
037: *
038: * @param persistentObject object to update
039: * @param controller
040: * @return number of row affected or RC_NON_DIRTY value if record is not "dirty". Should not be used for batch updates or complex/compound objects
041: * @throws OdalPersistencyException
042: *
043: */
044: int update(PersistentObject persistentObject,
045: LifeCycleController controller)
046: throws OdalPersistencyException;
047:
048: /**
049: * Update persistent object. Key values are the ones of primary key and "optimistic lock" fields.
050: *
051: * @param persistentObject object to update
052: * @param extraWhere sql fragment
053: * @param extraParameters optional parameters for extraWhere sql fragment
054: * @param controller LifeCycleController
055: * @return number of row affected or RC_NON_DIRTY value if record is not "dirty". Should not be used for batch updates or complex/compound objects
056: * @throws OdalPersistencyException
057: *
058: */
059: int update(PersistentObject persistentObject, String extraWhere,
060: Object[] extraParameters, LifeCycleController controller)
061: throws OdalPersistencyException;
062:
063: /**
064: * Update persistent object. Key values are the ones of primary key and "optimistic lock" fields.
065: *
066: * @param persistentObject object to update
067: * @param extraWhere sql fragment
068: * @param extraParameters optional parameters for extraWhere sql fragment
069: * @param controller LifeCycleController
070: * @return number of row affected or RC_NON_DIRTY value if record is not "dirty". Should not be used for batch updates or complex/compound objects
071: * @throws OdalPersistencyException
072: *
073: */
074: int update(PersistentObject persistentObject, String extraWhere,
075: Parameters extraParameters, LifeCycleController controller)
076: throws OdalPersistencyException;
077:
078: /**
079: * Execute ad-hoc data modifying sql.
080: *
081: * @param sql SQL statement to execute
082: * @param parameters parameters
083: * @return number of row affected or RC_NON_DIRTY value if record is not "dirty". Should not be used for batch updates or complex/compound objects
084: * @throws OdalPersistencyException
085: *
086: */
087: int executeUpdate(String sql, Parameters parameters)
088: throws OdalPersistencyException;
089:
090: /**
091: * Execute ad-hoc data modifying sql.
092: *
093: * @param sql SQL statement to execute
094: * @return number of row affected or RC_NON_DIRTY value if record is not "dirty". Should not be used for batch updates or complex/compound objects
095: * @throws OdalPersistencyException
096: *
097: */
098: int executeUpdate(String sql) throws OdalPersistencyException;
099:
100: /**
101: * Execute ad-hoc data modifying sql.
102: *
103: * @param sql SQL statement to execute
104: * @param values values to use as SQL parameters. The parameter types will be extrapolated
105: * @return number of row affected or RC_NON_DIRTY value if record is not "dirty". Should not be used for batch updates or complex/compound objects
106: * @throws OdalPersistencyException
107: *
108: */
109: int executeUpdate(String sql, Object[] values)
110: throws OdalPersistencyException;
111:
112: /**
113: * Execute truncate table sql.
114: *
115: * @param tableName
116: * @return number of row affected.
117: * @throws OdalPersistencyException
118: *
119: */
120: int truncate(String tableName) throws OdalPersistencyException;
121:
122: /**
123: * Delete persistent object by primary key
124: *
125: * @param persistentObject
126: * @return number of row affected. Should not be used for batch updates or complex/compound objects
127: * @throws OdalPersistencyException
128: *
129: */
130: int delete(PersistentObject persistentObject)
131: throws OdalPersistencyException;
132:
133: /**
134: * Delete persistent object by primary key
135: *
136: * @param persistentObject
137: * @param controller
138: * @return number of row affected. Should not be used for batch updates or complex/compound objects
139: * @throws OdalPersistencyException
140: *
141: */
142: int delete(PersistentObject persistentObject,
143: LifeCycleController controller)
144: throws OdalPersistencyException;
145:
146: /**
147: * Deletes persistent object "by example" PersistentObject. The fields and their values that are set on the object are then joined by "and" into sql where clause.
148: *
149: * @param persistentObject
150: * @return number of row affected. Should not be used for batch updates or complex/compound objects
151: * @throws OdalPersistencyException
152: *
153: */
154: int deleteByExample(PersistentObject persistentObject)
155: throws OdalPersistencyException;
156:
157: /**
158: * Deletes persistent object "by example" PersistentObject. The fields and their values that are set on the object are then joined by "and" into sql where clause.
159: *
160: * @param persistentObject
161: * @param controller LifeCycleController
162: * @return number of row affected. Should not be used for batch updates or complex/compound objects
163: * @throws OdalPersistencyException
164: *
165: */
166: int deleteByExample(PersistentObject persistentObject,
167: LifeCycleController controller)
168: throws OdalPersistencyException;
169:
170: /**
171: * Deletes persistent object "by example" PersistentObject. The fields and their values that are set on the object are then joined by "and" into sql where clause.
172: *
173: * @param persistentObject
174: * @param limit max number of rows to delete (limit must be supported by the database)
175: * @return number of row affected. Should not be used for batch updates or complex/compound objects
176: * @throws OdalPersistencyException
177: *
178: */
179: int deleteByExample(PersistentObject persistentObject, int limit)
180: throws OdalPersistencyException;
181:
182: /**
183: * Deletes persistent object "by example" PersistentObject. The fields and their values that are set on the object are then joined by "and" into sql where clause.
184: *
185: * @param persistentObject
186: * @param controller LifeCycleController
187: * @param limit max number of rows to delete (limit must be supported by the database)
188: * @return number of row affected. Should not be used for batch updates or complex/compound objects
189: * @throws OdalPersistencyException
190: *
191: */
192: int deleteByExample(PersistentObject persistentObject,
193: LifeCycleController controller, int limit)
194: throws OdalPersistencyException;
195:
196: /**
197: * Insert collection of persistent objects
198: *
199: * @param persistentObjects
200: * @return array of return codes - one per collection entry
201: * @throws OdalPersistencyException
202: *
203: */
204: int[] insert(Collection persistentObjects)
205: throws OdalPersistencyException;
206:
207: /**
208: * Delete collection of persistent objects
209: *
210: * @param persistentObjects
211: * @return array of return codes - one per collection entry
212: * @throws OdalPersistencyException
213: *
214: */
215: int[] delete(Collection persistentObjects)
216: throws OdalPersistencyException;
217:
218: /**
219: * Update collection of persistent objects
220: *
221: * @param persistentObjects
222: * @return array of return codes - one per collection entry
223: * @throws OdalPersistencyException
224: *
225: */
226: int[] update(Collection persistentObjects)
227: throws OdalPersistencyException;
228:
229: /**
230: * Update collection of persistent objects
231: *
232: * @param collection
233: * @param lifeCycleController
234: * @return array of return codes - one per collection entry
235: * @throws OdalPersistencyException
236: *
237: */
238: int[] update(Collection collection,
239: LifeCycleController lifeCycleController)
240: throws OdalPersistencyException;
241:
242: /**
243: * Update collection of persistent objects.
244: * TracingCollection collection will be matched with the source one and "trced".
245: * That is objects that are in collection but not in source will be deleted,
246: * that are not in collection but are in source will be inserted, objects that are in
247: * both but "dirty" will be updated
248: *
249: * @param collection
250: * @param source
251: * @param lifeCycleController
252: * @return array of return codes - one per collection entry
253: * @throws OdalPersistencyException
254: *
255: */
256: int[] update(TracingCollection collection, Collection source,
257: LifeCycleController lifeCycleController)
258: throws OdalPersistencyException;
259:
260: /**
261: * Update collection of persistent objects.
262: * TracingCollection collection will be matched with the source one and "trced".
263: * That is objects that are in collection but not in source will be deleted,
264: * that are not in collection but are in source will be inserted, objects that are in
265: * both but "dirty" will be updated
266: *
267: * @param collection
268: * @param source
269: * @return array of return codes - one per collection entry
270: * @throws OdalPersistencyException
271: *
272: */
273: int[] update(TracingCollection collection, Collection source)
274: throws OdalPersistencyException;
275:
276: /**
277: * Forces insert on object that is already saved in the database. This method is
278: * designed to work with piping from one database to another
279: *
280: * @param persistentObject
281: * @param controller
282: * @return
283: * @throws OdalPersistencyException
284: */
285: int pipeInsert(PersistentObject persistentObject,
286: LifeCycleController controller)
287: throws OdalPersistencyException;
288:
289: /**
290: * Forces insert on object that is already saved in the database. This method is
291: * designed to work with piping from one database to another
292: *
293: * @param persistentObject
294: * @return
295: * @throws OdalPersistencyException
296: */
297: int pipeInsert(PersistentObject persistentObject)
298: throws OdalPersistencyException;
299:
300: }
|