|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.ujoframework.orm.Session
public class Session
The ORM session.
Methods of the session are not thread safe.
| Field Summary | |
|---|---|
static java.lang.String |
SQL_ILLEGAL
Exception SQL message prefix |
| Method Summary | ||
|---|---|---|
void |
cacheClear()
Clear the cache. |
|
void |
close()
Close and release all DB connections. |
|
void |
commit()
Make a commit for all databases. |
|
protected void |
commit(boolean commit)
Make commit/rollback for all 'production' databases. |
|
protected Criterion |
createPkCriterion(OrmUjo bo)
Returns an criterion by a PrimaryKey |
|
|
createQuery(java.lang.Class<UJO> aClass)
For all rows. |
|
|
createQuery(java.lang.Class<UJO> aClass,
Criterion<UJO> criterion)
|
|
|
createQuery(Criterion<UJO> criterion)
The table class is derived from the first criterion column. |
|
|
delete(java.lang.Class<UJO> tableClass,
Criterion<UJO> criterion)
Delete all object object by the criterion from parameter. |
|
|
delete(Criterion<UJO> criterion)
Delete all object object by the criterion from parameter. |
|
protected
|
delete(MetaTable tableModel,
Criterion<UJO> criterion)
Delete all objects object form parameter Warning: method does not remove deleted object from internal cache, however you can call method clearCache() to release all objects from the cache. |
|
boolean |
delete(OrmUjo bo)
Delete one object from the parameters. |
|
OrmUjo |
findCache(java.lang.Class type,
java.lang.Object... pkeys)
Find object from internal cache |
|
OrmUjo |
findCache(java.lang.Class type,
java.lang.Object pkey)
Find object from internal cache |
|
MetaRelation2Many |
getBasicColumn(Criterion criterion)
Returns the first "basic" column of criterion. |
|
java.sql.Connection |
getConnection(MetaDatabase database)
Get connection for a required database with an autocommit na false. |
|
|
getDatabase(java.lang.Class<DB> dbType)
Returns a Database instance |
|
OrmHandler |
getHandler()
Returns a handler |
|
protected java.util.List<MetaColumn> |
getOrmColumns(UjoProperty... properties)
Convert a property array to a column list. |
|
MetaParams |
getParameters()
Returns parameters |
|
|
getRowCount(Query<UJO> query)
Returns a count of rows |
|
JdbcStatement |
getStatement(MetaDatabase database,
java.lang.CharSequence sql)
Create new statement |
|
JdbcStatement |
getStatement(Query query)
Run SQL SELECT by query. |
|
|
iterateInternal(RelationToMany property,
OrmUjo value)
Iterate property of values |
|
|
load(java.lang.Class<UJO> tableType,
java.lang.Object id)
Load UJO by a unique id. |
|
|
loadInternal(UjoProperty relatedProperty,
java.lang.Object id,
boolean mandatory)
Load UJO by a unique id. |
|
void |
rollback()
Make a rollback for all databases. |
|
void |
save(OrmUjo bo)
INSERT object into table. |
|
int |
update(OrmUjo bo)
UPDATE object into table. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String SQL_ILLEGAL
| Method Detail |
|---|
public final OrmHandler getHandler()
public void commit()
public void rollback()
protected void commit(boolean commit)
commit - if parameters is false than make a rollback.public <UJO extends OrmUjo> Query<UJO> createQuery(java.lang.Class<UJO> aClass)
public <UJO extends OrmUjo> Query<UJO> createQuery(java.lang.Class<UJO> aClass,
Criterion<UJO> criterion)
public <UJO extends OrmUjo> Query<UJO> createQuery(Criterion<UJO> criterion)
public MetaRelation2Many getBasicColumn(Criterion criterion)
public <DB extends OrmUjo> DB getDatabase(java.lang.Class<DB> dbType)
public void save(OrmUjo bo)
throws java.lang.IllegalStateException
java.lang.IllegalStateException
public int update(OrmUjo bo)
throws java.lang.IllegalStateException
java.lang.IllegalStateExceptionpublic <UJO extends OrmUjo> int delete(Criterion<UJO> criterion)
criterion - filter for deleting tables.
public boolean delete(OrmUjo bo)
bo - Business object to delete
public <UJO extends OrmUjo> int delete(java.lang.Class<UJO> tableClass,
Criterion<UJO> criterion)
tableClass - Type of table to deletecriterion - filter for deleting tables.
protected <UJO extends OrmUjo> int delete(MetaTable tableModel,
Criterion<UJO> criterion)
tableModel - Type of table to deletecriterion - filter for deleting tables.
protected java.util.List<MetaColumn> getOrmColumns(UjoProperty... properties)
protected Criterion createPkCriterion(OrmUjo bo)
public <UJO extends OrmUjo> long getRowCount(Query<UJO> query)
public JdbcStatement getStatement(Query query)
public <UJO extends OrmUjo> UjoIterator<UJO> iterateInternal(RelationToMany property,
OrmUjo value)
property - Table propertyvalue - A value type of OrmUjo
public final java.sql.Connection getConnection(MetaDatabase database)
throws java.lang.IllegalStateException
java.lang.IllegalStateException
public JdbcStatement getStatement(MetaDatabase database,
java.lang.CharSequence sql)
throws java.sql.SQLException
java.sql.SQLException
public <UJO extends OrmUjo> UJO load(java.lang.Class<UJO> tableType,
java.lang.Object id)
throws java.util.NoSuchElementException
tableType - Type of Ujoid - Value ID
java.util.NoSuchElementException
public <UJO extends OrmUjo> UJO loadInternal(UjoProperty relatedProperty,
java.lang.Object id,
boolean mandatory)
throws java.util.NoSuchElementException
relatedProperty - Related propertyid - Valud IDmandatory - If result is mandatory then the method throws an exception if no object was found else returns null;
java.util.NoSuchElementException
public void close()
throws java.lang.IllegalStateException
java.lang.IllegalStateException - The exception contains a bug from Connection close;
public OrmUjo findCache(java.lang.Class type,
java.lang.Object pkey)
public OrmUjo findCache(java.lang.Class type,
java.lang.Object... pkeys)
public void cacheClear()
public final MetaParams getParameters()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||