|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectit.biobytes.ammentos.Ammentos
public class Ammentos
This class represents the persistence framework itself. Provides all methods for managing objects persistence: save, load, lookup by primary key and delete operations. These operations can be atomic or can be performed into a transaction by using the transaction related methods such as openTransaction(), commitTransaction() and rollbackTransaction(). An internal caching mechanism dramatically optimizes direct lookup() calls. Furthermore is possible to receive persistence events by registering PersistenceListeners objects to the Framework.
Constructor Summary | |
---|---|
Ammentos()
|
Method Summary | ||
---|---|---|
static void |
addPersistenceListener(PersistenceListener listener)
Adds a PersistenceListener to the framework. |
|
static void |
commitTransaction()
Commits the current transaction. |
|
static
|
createInstance(java.lang.Class<T> c)
Creates a new instance of the provided object. |
|
static
|
delete(T obj)
Deletes the object. |
|
static
|
diff(T obj1,
T obj2)
Returns a "diff" report for the provided objects |
|
static java.sql.Connection |
getDbConnection()
Returns a connection to the underlying database. |
|
static Metadata |
getMetadata(java.lang.Class c)
Returns the metadata for the objects that belong to the provided class. |
|
static Field |
getPrimaryKeyField(java.lang.Class c)
Gets the primary key field for the objects of the provided class |
|
static
|
load(java.lang.Class<T> c,
java.lang.Object primaryKey)
Loads the object whith the provided primary key |
|
static
|
load(java.lang.Class<T> c,
Query qry)
Loads the objects which match the provided query. |
|
static
|
loadUpdatable(java.lang.Class<T> c,
Query qry)
Returns an updatable list of objects which match the provided query. |
|
static
|
lookup(java.lang.Class<T> c,
java.lang.Object primaryKey)
Lookup the object of the provided class whith the specified primary key. |
|
static void |
openTransaction()
Opens a transaction to the datatabse. |
|
static void |
openTransaction(int isolationLevel)
Opens a transaction to the datatabse. |
|
static void |
removePersistenceListener(PersistenceListener listener)
|
|
static void |
rollbackTransaction()
Rolls back the current transaction. |
|
static
|
save(T obj)
Saves the provided object instance. |
|
static void |
setDataSource(javax.sql.DataSource source)
Sets the datasource for this framework |
|
static
|
validate(java.lang.Class<T> c,
T obj)
Validates the provided Object using its related validator |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Ammentos()
Method Detail |
---|
public static Metadata getMetadata(java.lang.Class c) throws PersistenceException
c
- The class to get metadata for
PersistenceException
- If the provided class does not contain valid metadata
informationpublic static <T> T createInstance(java.lang.Class<T> c) throws PersistenceException
c
- The class of the object to create
PersistenceException
- If any errors occurred while trying to create the instancepublic static <T> void save(T obj) throws PersistenceException
obj
- The object to save
PersistenceException
- If any errors occurr while saving the objectpublic static <T> void delete(T obj) throws PersistenceException
obj
- The object to delete
PersistenceException
public static <T> T load(java.lang.Class<T> c, java.lang.Object primaryKey) throws PersistenceException
c
- primaryKey
-
PersistenceException
public static <T> java.util.List<T> load(java.lang.Class<T> c, Query qry) throws PersistenceException
c
- qry
-
PersistenceException
public static <T> java.util.List<T> loadUpdatable(java.lang.Class<T> c, Query qry) throws PersistenceException
PersistenceException
public static Field getPrimaryKeyField(java.lang.Class c) throws PersistenceException
c
-
PersistenceException
public static <T> T lookup(java.lang.Class<T> c, java.lang.Object primaryKey) throws PersistenceException
c
- primaryKey
-
PersistenceException
public static void setDataSource(javax.sql.DataSource source)
source
- public static void openTransaction() throws PersistenceException
PersistenceException
public static void openTransaction(int isolationLevel) throws PersistenceException
PersistenceException
public static void rollbackTransaction() throws PersistenceException
PersistenceException
public static void commitTransaction() throws PersistenceException
PersistenceException
public static java.sql.Connection getDbConnection() throws PersistenceException
PersistenceException
public static <T> void validate(java.lang.Class<T> c, T obj) throws PersistenceException
obj
-
PersistenceException
public static <T> java.util.List<Field> diff(T obj1, T obj2) throws PersistenceException
PersistenceException
public static void addPersistenceListener(PersistenceListener listener)
listener
- public static void removePersistenceListener(PersistenceListener listener)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |