Class Update
- java.lang.Object
-
- org.castor.cpa.persistence.sql.query.Update
-
- All Implemented Interfaces:
QueryObject
public final class Update extends java.lang.Object implements QueryObject
Class to generate SQL update query statements.
Note: Be aware that the SQL statement will be invalid without any assignment of for empty compound conditions.- Version:
- $Revision$ $Date: 2009-07-13 17:22:43 (Mon, 13 Jul 2009) $
- Author:
- Ahmad Hassan, Ralf Joachim, Dennis Butterstein
-
-
Constructor Summary
Constructors Constructor Description Update(java.lang.String name)Construct a SQL update statement that updates records of the table provided.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaccept(Visitor visitor)Accept method to handle incoming visitors.voidaddAssignment(Assignment assignment)Appends given assignment to the list of Assignment objects.voidaddAssignment(Column column, Expression value)Appends an assignment of the given value to the given column.java.util.List<Assignment>getAssignment()Get method returning current list of assignments.ConditiongetCondition()Get condition that specifies which records to update.QualifiergetQualifier()Get method returning qualifier currently set.voidsetCondition(Condition condition)Set condition that specifies which records to update.java.lang.StringtoString()Method constructing query string.
-
-
-
Method Detail
-
addAssignment
public void addAssignment(Assignment assignment)
Appends given assignment to the list of Assignment objects.- Parameters:
assignment- Assignment object added to the list of assignments that will be appended to SET clause of sql statement.
-
addAssignment
public void addAssignment(Column column, Expression value)
Appends an assignment of the given value to the given column.- Parameters:
column- Column to assign the value to.value- Expression to be assigned to the column.
-
getCondition
public Condition getCondition()
Get condition that specifies which records to update.- Returns:
- Condition that specifies which records to update.
-
setCondition
public void setCondition(Condition condition)
Set condition that specifies which records to update.- Parameters:
condition- Condition that specifies which records to update.
-
getQualifier
public Qualifier getQualifier()
Get method returning qualifier currently set.- Returns:
- Qualifier of the table to update records of.
-
getAssignment
public java.util.List<Assignment> getAssignment()
Get method returning current list of assignments.- Returns:
- List of assignments.
-
accept
public void accept(Visitor visitor)
Accept method to handle incoming visitors.- Specified by:
acceptin interfaceQueryObject- Parameters:
visitor- Visitor to be handled.
-
toString
public java.lang.String toString()
Method constructing query string.- Overrides:
toStringin classjava.lang.Object- Returns:
- Constructed query string.
-
-