T
- A class derivated from ResourceRepresentation
public interface Persistable<T extends Resource>
ResourceRepresentation
Modifier and Type | Method and Description |
---|---|
int |
deleteResource(T resource)
This method has to delete the specified resource
|
<ID> T |
findById(ID resourceId)
This method has to return the resource corresponding to the given ID.
|
java.util.List<T> |
queryForAll()
This method has to return all resources of the parameterized type defined by the interface
|
void |
updateOrCreate(T resource)
This method has to create a new resource or update it if already exists.
|
int |
updateResource(T resource)
This method has to update the specified resource
|
void updateOrCreate(T resource) throws java.lang.Exception
resource
- The resource to create or updatejava.sql.SQLException
- if a sql error occurs.java.lang.Exception
<ID> T findById(ID resourceId) throws java.lang.Exception
ResourceRepresentation
id field typeresourceId
- The id of the resourcejava.sql.SQLException
- if a sql error occursjava.lang.Exception
java.util.List<T> queryForAll() throws java.lang.Exception
java.sql.SQLException
- if a sql error occursjava.lang.Exception
int deleteResource(T resource) throws java.lang.Exception
resource
- The resource to deletejava.sql.SQLException
- if a sql error occursjava.lang.Exception
int updateResource(T resource) throws java.lang.Exception
resource
- The resource to updatejava.sql.SQLException
- if a sql error occursjava.lang.Exception