Mega Code Archive

 
Categories / Java Tutorial / Database
 

Update annotation

The Update annotation is used to decorate a method specifying an SQL update statement. The method's return value can be an int or void. Only if the return value type is int will the update count be returned. ElementTypeAccessibility sql or valueStringThe SQL statement to be executed keysGenerated KeysIndicates if autogenerated keys are returned. The default value is GeneratedKeys.NO_KEYS_RETURNED import java.sql.BaseQuery; import java.sql.DataSet; import java.sql.Select; public interface UserQueries extends BaseQuery {     // Delete user     @Update ("DELETE Users WHERE firstName={firstName}" +              "AND lastName={lastName}")     int deleteUser (String firstName, String lastName); }