|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface BeanSession
Describe a simple ORM interface that can perform CRUD for Beans according to properties defined programmatically on BeanManager. It can also load lists and unique beans based on properties set on a given bean. It also supports dynamic update, in other words, it will only update fields from a bean loaded from the database that were actually modified during the session. The behavior can be turned off when necessary ,in other words, when you want to blindly update all properties from a bean in the database regarding of whether they were modified or not.
| Method Summary | ||
|---|---|---|
String |
buildSelect(Class<? extends Object> beanClass)
|
|
String |
buildSelect(Class<? extends Object> beanClass,
Object... properties)
|
|
String |
buildSelect(Class<? extends Object> beanClass,
String tableName)
|
|
String |
buildSelect(Class<? extends Object> beanClass,
String tableName,
Object... properties)
|
|
String |
buildSelectMinus(Class<? extends Object> beanClass,
Object... minus)
|
|
String |
buildSelectMinus(Class<? extends Object> beanClass,
String tableName,
Object... minus)
|
|
int |
countList(Object bean)
Count the number of beans that would be returned by a loadList method. |
|
void |
createTable(Class<? extends Object> beanKlass)
|
|
void |
createTables()
|
|
boolean |
delete(Object bean)
Delete the bean from the database. |
|
Connection |
getConnection()
Get the database connection being used by this bean session. |
|
void |
insert(Object bean)
Insert the bean in the database. |
|
boolean |
load(Object bean)
Load the bean from the database, injecting all its properties through reflection. |
|
boolean |
load(Object bean,
Object... properties)
|
|
|
loadList(E bean)
Load a list of beans based on the properties present in the bean passed. |
|
|
loadList(E bean,
Limit limit)
Same as loadList(bean) except that you can limit the number of beans returned in the list. |
|
|
loadList(E bean,
Limit limit,
Object... properties)
|
|
|
loadList(E bean,
Object... properties)
|
|
|
loadList(E bean,
OrderBy orderBy)
Same as loadList(bean) except that you can order the list returned by passing an SQL orderBy clause. |
|
|
loadList(E bean,
OrderBy orderBy,
Limit limit)
Same as loadList(bean) except that you can limit the number of beans returned in the list as well as sort them by passing a orderBy SQL clause. |
|
|
loadList(E bean,
OrderBy orderBy,
Limit limit,
Object... properties)
|
|
|
loadList(E bean,
OrderBy orderBy,
Object... properties)
|
|
|
loadListMinus(E bean,
Limit limit,
Object... minus)
|
|
|
loadListMinus(E bean,
Object... minus)
|
|
|
loadListMinus(E bean,
OrderBy orderBy,
Limit limit,
Object... minus)
|
|
|
loadListMinus(E bean,
OrderBy orderBy,
Object... minus)
|
|
boolean |
loadMinus(Object bean,
Object... minus)
|
|
|
loadUnique(E bean)
Same as loadList(bean) but it attempts to load a single bean only. |
|
|
loadUnique(E bean,
Object... properties)
|
|
|
loadUniqueMinus(E bean,
Object... minus)
|
|
void |
populateBean(ResultSet rset,
Object bean)
|
|
void |
populateBean(ResultSet rset,
Object bean,
Object... properties)
|
|
void |
populateBean(ResultSet rset,
Object bean,
String tableName)
|
|
void |
populateBean(ResultSet rset,
Object bean,
String tableName,
Object... properties)
|
|
void |
populateBeanMinus(ResultSet rset,
Object bean,
Object... minus)
|
|
void |
populateBeanMinus(ResultSet rset,
Object bean,
String tableName,
Object... minus)
|
|
int |
update(Object bean)
Update the bean in the database. |
|
int |
updateAll(Object bean)
Same as update(bean) but here you can turn off the default dynamic update behavior and force all bean properties to be updated regardless whether they have been modified or not. |
|
| Method Detail |
|---|
Connection getConnection()
boolean load(Object bean)
bean - The bean we want to load from the DB.
boolean load(Object bean,
Object... properties)
boolean loadMinus(Object bean,
Object... minus)
int update(Object bean)
bean - The bean to be updated
int updateAll(Object bean)
bean -
Exceptionvoid insert(Object bean)
bean - The bean to insertboolean delete(Object bean)
bean -
Exceptionint countList(Object bean)
bean - The bean holding the properties used by the list query.
<E> List<E> loadList(E bean)
E - bean - The bean holding the properties used by the list query.
<E> List<E> loadList(E bean,
Object... properties)
<E> List<E> loadListMinus(E bean,
Object... minus)
<E> List<E> loadList(E bean,
OrderBy orderBy)
E - bean - The bean holding the properties used by the list query.orderBy - The orderBy SQL clause.
<E> List<E> loadList(E bean,
OrderBy orderBy,
Object... properties)
<E> List<E> loadListMinus(E bean,
OrderBy orderBy,
Object... minus)
<E> List<E> loadList(E bean,
Limit limit)
E - bean - The bean holding the properties used by the list query.limit - The max number of beans returned in the list.
<E> List<E> loadList(E bean,
Limit limit,
Object... properties)
<E> List<E> loadListMinus(E bean,
Limit limit,
Object... minus)
<E> List<E> loadList(E bean,
OrderBy orderBy,
Limit limit)
E - bean - The bean holding the properties used by the list query.orderBy - The orderBy SQL clause.limit - The max number of beans returned in the list.
<E> List<E> loadList(E bean,
OrderBy orderBy,
Limit limit,
Object... properties)
<E> List<E> loadListMinus(E bean,
OrderBy orderBy,
Limit limit,
Object... minus)
<E> E loadUnique(E bean)
E - bean - The bean holding the properties used by the load query.
BeanException - if more than one bean is found by the query.
<E> E loadUnique(E bean,
Object... properties)
<E> E loadUniqueMinus(E bean,
Object... minus)
String buildSelect(Class<? extends Object> beanClass)
String buildSelect(Class<? extends Object> beanClass,
Object... properties)
String buildSelectMinus(Class<? extends Object> beanClass,
Object... minus)
String buildSelect(Class<? extends Object> beanClass,
String tableName)
String buildSelect(Class<? extends Object> beanClass,
String tableName,
Object... properties)
String buildSelectMinus(Class<? extends Object> beanClass,
String tableName,
Object... minus)
void populateBean(ResultSet rset,
Object bean)
void populateBean(ResultSet rset,
Object bean,
Object... properties)
void populateBeanMinus(ResultSet rset,
Object bean,
Object... minus)
void populateBean(ResultSet rset,
Object bean,
String tableName)
void populateBean(ResultSet rset,
Object bean,
String tableName,
Object... properties)
void populateBeanMinus(ResultSet rset,
Object bean,
String tableName,
Object... minus)
void createTable(Class<? extends Object> beanKlass)
void createTables()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||