01: package net.sourceforge.jaxor.api;
02:
03: import net.sourceforge.jaxor.MetaRow;
04: import net.sourceforge.jaxor.QueryParams;
05:
06: import java.io.Serializable;
07: import java.sql.Connection;
08: import java.sql.ResultSet;
09: import java.util.List;
10:
11: /**
12: * @author mrettig
13: *
14: * This interface allows for the query of objects from the database. It also provides caching
15: * and unit of work functionality. Changes to entites are registered to the connection.
16: */
17: public interface JaxorContext extends Serializable, UpdateListener {
18:
19: EntityInterface load(ResultSet rs, MetaRow clzz);
20:
21: QueryResult query(String sql, MetaRow meta);
22:
23: QueryResult query(String sql, QueryParams args, MetaRow meta);
24:
25: void flush();
26:
27: void commit();
28:
29: InstanceCache getCache();
30:
31: QueryCache getQueryCache();
32:
33: UnitOfWork getUnitOfWork();
34:
35: void setCache(InstanceCache cache);
36:
37: void setQueryCache(QueryCache cache);
38:
39: void setUnitOfWork(UnitOfWork work);
40:
41: void registerNew(EntityInterface entity);
42:
43: void registerUpdate(EntityInterface entity);
44:
45: void registerDelete(EntityInterface entity);
46:
47: Connection getConnection();
48:
49: void setTransaction(JaxorTransaction trans);
50:
51: JaxorTransaction getTransaction();
52:
53: void end();
54:
55: /**
56: * The user attributes are used during inserts/updates that have a user field.
57: */
58: public void setUser(String user);
59:
60: public String getUser();
61:
62: InstanceFactory getInstanceFactory();
63:
64: EntityInterface createEntity(MetaRow clzz);
65:
66: FinderAdapter getFinder(Class finderClass);
67:
68: net.sourceforge.jaxor.api.MapperRegistry getMapperRegistry();
69:
70: Object createListImpl(List list, Class listImplClass);
71: }
|