org.ofbiz.entity.datasource
Class GenericDAO
java.lang.Object
org.ofbiz.entity.datasource.GenericDAO
public class GenericDAO
- extends java.lang.Object
Generic Entity Data Access Object - Handles persistence for any defined entity.
Constructor Summary |
GenericDAO(java.lang.String helperName)
|
Method Summary |
void |
checkDb(java.util.Map<java.lang.String,ModelEntity> modelEntities,
java.util.List<java.lang.String> messages,
boolean addMissing)
|
int |
delete(GenericEntity entity)
|
int |
delete(GenericEntity entity,
SQLProcessor sqlP)
|
int |
deleteByCondition(ModelEntity modelEntity,
EntityCondition condition)
|
int |
deleteByCondition(ModelEntity modelEntity,
EntityCondition condition,
SQLProcessor sqlP)
|
static GenericDAO |
getGenericDAO(java.lang.String helperName)
|
java.util.List<ModelEntity> |
induceModelFromDb(java.util.Collection<java.lang.String> messages)
Creates a list of ModelEntity objects based on meta data from the database |
int |
insert(GenericEntity entity)
|
void |
partialSelect(GenericEntity entity,
java.util.Set<java.lang.String> keys)
|
void |
select(GenericEntity entity)
|
void |
select(GenericEntity entity,
SQLProcessor sqlP)
|
java.util.List<GenericValue> |
selectByMultiRelation(GenericValue value,
ModelRelation modelRelationOne,
ModelEntity modelEntityOne,
ModelRelation modelRelationTwo,
ModelEntity modelEntityTwo,
java.util.List<java.lang.String> orderBy)
|
long |
selectCountByCondition(ModelEntity modelEntity,
EntityCondition whereEntityCondition,
EntityCondition havingEntityCondition,
EntityFindOptions findOptions)
|
EntityListIterator |
selectListIteratorByCondition(ModelEntity modelEntity,
EntityCondition whereEntityCondition,
EntityCondition havingEntityCondition,
java.util.Collection<java.lang.String> fieldsToSelect,
java.util.List<java.lang.String> orderBy,
EntityFindOptions findOptions)
Finds GenericValues by the conditions specified in the EntityCondition object, the the EntityCondition javadoc for more details. |
int |
update(GenericEntity entity)
|
int |
updateAll(GenericEntity entity)
|
int |
updateByCondition(ModelEntity modelEntity,
java.util.Map<java.lang.String,? extends java.lang.Object> fieldsToSet,
EntityCondition condition)
|
int |
updateByCondition(ModelEntity modelEntity,
java.util.Map<java.lang.String,? extends java.lang.Object> fieldsToSet,
EntityCondition condition,
SQLProcessor sqlP)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
module
public static final java.lang.String module
genericDAOs
protected static java.util.Map<java.lang.String,GenericDAO> genericDAOs
helperName
protected java.lang.String helperName
modelFieldTypeReader
protected ModelFieldTypeReader modelFieldTypeReader
datasourceInfo
protected DatasourceInfo datasourceInfo
GenericDAO
public GenericDAO(java.lang.String helperName)
getGenericDAO
public static GenericDAO getGenericDAO(java.lang.String helperName)
insert
public int insert(GenericEntity entity)
throws GenericEntityException
- Throws:
GenericEntityException
updateAll
public int updateAll(GenericEntity entity)
throws GenericEntityException
- Throws:
GenericEntityException
update
public int update(GenericEntity entity)
throws GenericEntityException
- Throws:
GenericEntityException
updateByCondition
public int updateByCondition(ModelEntity modelEntity,
java.util.Map<java.lang.String,? extends java.lang.Object> fieldsToSet,
EntityCondition condition)
throws GenericEntityException
- Throws:
GenericEntityException
updateByCondition
public int updateByCondition(ModelEntity modelEntity,
java.util.Map<java.lang.String,? extends java.lang.Object> fieldsToSet,
EntityCondition condition,
SQLProcessor sqlP)
throws GenericEntityException
- Throws:
GenericEntityException
select
public void select(GenericEntity entity)
throws GenericEntityException
- Throws:
GenericEntityException
select
public void select(GenericEntity entity,
SQLProcessor sqlP)
throws GenericEntityException
- Throws:
GenericEntityException
partialSelect
public void partialSelect(GenericEntity entity,
java.util.Set<java.lang.String> keys)
throws GenericEntityException
- Throws:
GenericEntityException
selectListIteratorByCondition
public EntityListIterator selectListIteratorByCondition(ModelEntity modelEntity,
EntityCondition whereEntityCondition,
EntityCondition havingEntityCondition,
java.util.Collection<java.lang.String> fieldsToSelect,
java.util.List<java.lang.String> orderBy,
EntityFindOptions findOptions)
throws GenericEntityException
- Finds GenericValues by the conditions specified in the EntityCondition object, the the EntityCondition javadoc for more details.
- Parameters:
modelEntity
- The ModelEntity of the Entity as defined in the entity XML filewhereEntityCondition
- The EntityCondition object that specifies how to constrain this query before any groupings are done (if this is a view entity with group-by aliases)havingEntityCondition
- The EntityCondition object that specifies how to constrain this query after any groupings are done (if this is a view entity with group-by aliases)fieldsToSelect
- The fields of the named entity to get from the database; if empty or null all fields will be retreivedorderBy
- The fields of the named entity to order the query by; optionally add a " ASC" for ascending or " DESC" for descendingfindOptions
- An instance of EntityFindOptions that specifies advanced query options. See the EntityFindOptions JavaDoc for more details.
- Returns:
- EntityListIterator representing the result of the query: NOTE THAT THIS MUST BE CLOSED WHEN YOU ARE
DONE WITH IT, AND DON'T LEAVE IT OPEN TOO LONG BEACUSE IT WILL MAINTAIN A DATABASE CONNECTION.
- Throws:
GenericEntityException
selectByMultiRelation
public java.util.List<GenericValue> selectByMultiRelation(GenericValue value,
ModelRelation modelRelationOne,
ModelEntity modelEntityOne,
ModelRelation modelRelationTwo,
ModelEntity modelEntityTwo,
java.util.List<java.lang.String> orderBy)
throws GenericEntityException
- Throws:
GenericEntityException
selectCountByCondition
public long selectCountByCondition(ModelEntity modelEntity,
EntityCondition whereEntityCondition,
EntityCondition havingEntityCondition,
EntityFindOptions findOptions)
throws GenericEntityException
- Throws:
GenericEntityException
delete
public int delete(GenericEntity entity)
throws GenericEntityException
- Throws:
GenericEntityException
delete
public int delete(GenericEntity entity,
SQLProcessor sqlP)
throws GenericEntityException
- Throws:
GenericEntityException
deleteByCondition
public int deleteByCondition(ModelEntity modelEntity,
EntityCondition condition)
throws GenericEntityException
- Throws:
GenericEntityException
deleteByCondition
public int deleteByCondition(ModelEntity modelEntity,
EntityCondition condition,
SQLProcessor sqlP)
throws GenericEntityException
- Throws:
GenericEntityException
checkDb
public void checkDb(java.util.Map<java.lang.String,ModelEntity> modelEntities,
java.util.List<java.lang.String> messages,
boolean addMissing)
induceModelFromDb
public java.util.List<ModelEntity> induceModelFromDb(java.util.Collection<java.lang.String> messages)
- Creates a list of ModelEntity objects based on meta data from the database