com.groupdocs.annotation.data.dao.interfaces
Interface IDao<T extends ITable>

All Known Subinterfaces:
IAnnotationDao, ICollaboratorDao, IDocumentDao, IReplyDao, ISessionDao, ISystemInfoDao, IUserDao

public interface IDao<T extends ITable>

Interface to implement DAO

Author:
Aleksey Permyakov (29.09.2014)

Method Summary
 void createTableIfNotExists()
          Create table for entity
 int delete(T entity)
          Delete entity from database
 int insert(T entity)
          Insert entity to database
 List<T> selectAllBy(List<String> fieldNames, Object... fieldValues)
          Select all entity objects with specified values of fields
 T selectBy(List<String> fieldNames, Object... fieldValues)
          Select first found entity object with specified values of fields
 int update(T entity)
          Update entity in database
 

Method Detail

createTableIfNotExists

void createTableIfNotExists()
                            throws AnnotationException
Create table for entity

Throws:
AnnotationException

selectBy

T selectBy(List<String> fieldNames,
           Object... fieldValues)
                          throws AnnotationException
Select first found entity object with specified values of fields

Parameters:
fieldNames - list of field names (Recommend to use constants from entity class)
fieldValues - array of filed values according and in the same order to fieldNames
Returns:
first found entity object
Throws:
AnnotationException

selectAllBy

List<T> selectAllBy(List<String> fieldNames,
                    Object... fieldValues)
                                   throws AnnotationException
Select all entity objects with specified values of fields

Parameters:
fieldNames - list of field names (Recommend to use constants from entity class)
fieldValues - array of filed values according and in the same order to fieldNames
Returns:
list of found entity objects
Throws:
AnnotationException

insert

int insert(T entity)
Insert entity to database

Parameters:
entity - entity to insert
Throws:
AnnotationException

update

int update(T entity)
Update entity in database

Parameters:
entity - entity to update
Returns:
count of updated rows

delete

int delete(T entity)
Delete entity from database

Parameters:
entity - entity to delete
Returns:
count of deleted rows


Copyright © 2014. All rights reserved.