net.jot.persistance.query
Interface JOTQueryInterface

All Known Implementing Classes:
JOTDBQueryImpl, JOTFSQueryImpl

public interface JOTQueryInterface

Interface to query implementations
The query Implementations provide backend specific support for executing search querries for Models.

Author:
thibautc

Method Summary
 void alterAddField(JOTModelMapping mapping, JOTDBField field, java.lang.Object defaultValue)
          Add a new Field to a table The field must be defined in the DB Model.
 void createTable(JOTModelMapping mapping)
           
 void delete(JOTModel model)
          Delete record in backend
 void deleteTable(JOTModelMapping mapping)
          Delete the WHOLE TABLE in backend
 java.util.Vector find(JOTModelMapping mapping, java.lang.Class objectClass, JOTSQLQueryParams params)
          Returns all the records matching the parameters
 JOTModel findByID(JOTModelMapping mapping, java.lang.Class objectClass, long id)
          Returns the record whith the given ID
 JOTModel findOne(JOTModelMapping mapping, java.lang.Class objectClass, JOTSQLQueryParams params)
          Returns the first records matching the parameters
 java.util.Vector findUsingSQL(JOTModelMapping mapping, java.lang.Class objectClass, java.lang.String sql, java.lang.Object[] params)
          This is here, if you want to make manual custom SQL calls not covered by the other methods
NOTE: your request MUST return records matching your model.
THIS IS ONLY SUPPORTED WITH THE SQL Model (JOTDBModel)
 void save(JOTModel model)
          Saves record in backend
 

Method Detail

findByID

JOTModel findByID(JOTModelMapping mapping,
                  java.lang.Class objectClass,
                  long id)
                  throws java.lang.Exception
Returns the record whith the given ID

Parameters:
dataId -
Returns:
Throws:
java.lang.Exception

findUsingSQL

java.util.Vector findUsingSQL(JOTModelMapping mapping,
                              java.lang.Class objectClass,
                              java.lang.String sql,
                              java.lang.Object[] params)
                              throws java.lang.Exception
This is here, if you want to make manual custom SQL calls not covered by the other methods
NOTE: your request MUST return records matching your model.
THIS IS ONLY SUPPORTED WITH THE SQL Model (JOTDBModel)

Parameters:
sql - ie: "select * from 'users' where first=?, last=? order by name" ... etc ...
params - ie: ['John','Doe']
Returns:
Throws:
java.lang.Exception

findOne

JOTModel findOne(JOTModelMapping mapping,
                 java.lang.Class objectClass,
                 JOTSQLQueryParams params)
                 throws java.lang.Exception
Returns the first records matching the parameters

Returns:
Throws:
java.lang.Exception

find

java.util.Vector find(JOTModelMapping mapping,
                      java.lang.Class objectClass,
                      JOTSQLQueryParams params)
                      throws java.lang.Exception
Returns all the records matching the parameters

Returns:
Throws:
java.lang.Exception

createTable

void createTable(JOTModelMapping mapping)
                 throws java.lang.Exception
Throws:
java.lang.Exception

save

void save(JOTModel model)
          throws java.lang.Exception
Saves record in backend

Parameters:
model -
Throws:
java.lang.Exception

deleteTable

void deleteTable(JOTModelMapping mapping)
                 throws java.lang.Exception
Delete the WHOLE TABLE in backend

Parameters:
mapping -
Throws:
java.lang.Exception

delete

void delete(JOTModel model)
            throws java.lang.Exception
Delete record in backend

Parameters:
model -
Throws:
java.lang.Exception

alterAddField

void alterAddField(JOTModelMapping mapping,
                   JOTDBField field,
                   java.lang.Object defaultValue)
                   throws java.lang.Exception
Add a new Field to a table The field must be defined in the DB Model.

Throws:
java.lang.Exception