DBWeb
Class DetailModel
java.lang.Object
|
+--DBWeb.DetailModel
- public class DetailModel
- extends java.lang.Object
Constructor Summary |
DetailModel(java.lang.String table,
java.lang.String key,
java.lang.String field,
java.lang.String name)
|
Method Summary |
void |
addCondition(java.lang.String fieldName,
java.lang.String value)
|
java.lang.String |
toSql(java.lang.String id)
Returns a SQL query to retrieve the relevant DetailModel data for id.
|
java.lang.String |
toSqlDelete(java.lang.String id)
|
java.lang.String |
toSqlInsert()
Returns the sql command needed to insert a DetailModel relationship
into the database. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
baseTable
public java.lang.String baseTable
keyName
public java.lang.String keyName
conditions
public java.util.ArrayList conditions
fieldName
public java.lang.String fieldName
name
public java.lang.String name
DetailModel
public DetailModel(java.lang.String table,
java.lang.String key,
java.lang.String field,
java.lang.String name)
addCondition
public void addCondition(java.lang.String fieldName,
java.lang.String value)
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
toSql
public java.lang.String toSql(java.lang.String id)
- Returns a SQL query to retrieve the relevant DetailModel data for id.
Note that if name is given, we alias fieldName to name. This may make
it easier to populate the Entity for which this query is used.
- Parameters:
id
- String holding the key value for the Entity.
- Returns:
- String holding SQL command to execute.
toSqlInsert
public java.lang.String toSqlInsert()
- Returns the sql command needed to insert a DetailModel relationship
into the database. The command must be used in a PreparedStatement
because it contains a "?" in place of the value being inserted as well
as the key. The expectation is that this statement will be executed
several times, once per value associated with the name. Note that
instead of updating these detail relationships, we delete them and
re-insert them.
- Returns:
- String holding the SQL statement to prepare.
toSqlDelete
public java.lang.String toSqlDelete(java.lang.String id)