|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.sormula.operation.cascade.lazy.AbstractLazySelector<R> org.sormula.operation.cascade.lazy.DurableLazySelector<R>
R
- type of source row classpublic class DurableLazySelector<R>
A lazy cascade selector that uses a DataSource
or data source name to create the
Database
when performing the lazy select. Source rows must be selected with an operation that uses
a database created with Database.Database(DataSource)
,
Database.Database(DataSource, String)
, Database.Database(String)
, or Database.Database(String, String)
This class is slightly less efficient than SimpleLazySelector
because a Database
and Table
are created
when selector needs to be used. It is more flexible since it can be used any time even when original connection has been closed.
DurableLazySelector is good for scenario's when source row may be serialzed to disk, for example, in web application where source row is stored in web session.
Constructor Summary | |
---|---|
DurableLazySelector()
Constructs for use when DurableLazySelector is base class of row that will contain lazy select fields. |
|
DurableLazySelector(R source)
Constructs for use as delegate for row that will contain lazy select fields. |
Method Summary | |
---|---|
protected void |
closeDatabase()
Closes Database created with openDatabase() . |
javax.sql.DataSource |
getDataSource()
Gets the DataSource from database used by pendingLazySelects(Database) . |
java.lang.String |
getDataSourceName()
Gets the JNDI name to use to look up DataSource . |
java.lang.String |
getSchema()
Gets the schema from database used by pendingLazySelects(Database) . |
protected void |
openDatabase()
Creates a new instance of a Database from data source name or data source obtained in
pendingLazySelects(Database) . |
void |
pendingLazySelects(Database database)
DataSource and schema are obtained from database parameter. |
Methods inherited from class org.sormula.operation.cascade.lazy.AbstractLazySelector |
---|
begin, checkLazySelects, commit, getDatabase, getPendingLazySelectFields, getSource, initDatabase, initPendingLazySelectCascadeFields, isLocalTransaction, isPendingLazySelects, isUseTransaction, lazySelect, rollback, setDatabase, setUseTransaction |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DurableLazySelector()
AbstractLazySelector.setUseTransaction(boolean)
is true by default.
public DurableLazySelector(R source)
AbstractLazySelector.setUseTransaction(boolean)
is true by default.
source
- row that contains fields with SelectCascade.lazy()
is true; typically source
is the one side of a one-to-many relationship or source has a reference to the other class in a
one-to-one relationshipMethod Detail |
---|
public void pendingLazySelects(Database database) throws LazyCascadeException
DataSource
and schema are obtained from database parameter.
pendingLazySelects
in interface LazySelectable
pendingLazySelects
in class AbstractLazySelector<R>
database
- database that was used to select source row
LazyCascadeException
- if Database.getDataSource()
is nullpublic java.lang.String getDataSourceName()
DataSource
. This name was obtained from database by
pendingLazySelects(Database)
.
public javax.sql.DataSource getDataSource()
DataSource
from database used by pendingLazySelects(Database)
.
public java.lang.String getSchema()
pendingLazySelects(Database)
.
protected void openDatabase() throws LazyCascadeException
Database
from data source name or data source obtained in
pendingLazySelects(Database)
. Data source will be looked up in JNDI if data source
name is known and data source is not known.
openDatabase
in class AbstractLazySelector<R>
LazyCascadeException
- if errorprotected void closeDatabase() throws LazyCascadeException
Database
created with openDatabase()
.
closeDatabase
in class AbstractLazySelector<R>
LazyCascadeException
- if error
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |