JDBC Annotations : JDBC 4 Annotations « JDK 6 « Java





JDBC Annotations

 

import java.sql.BaseQuery;
import java.sql.DataSet;
import java.sql.Select;
public interface UserQueries extends BaseQuery {


    // Select all users
    @Select (sql ="SELECT userId, firstName, lastName FROM Users",
             readOnly=false, connected=false, tableName="Users")
    DataSet<User> getAllUsers ();


    // Select user by name */
    @Select (sql ="SELECT userId, firstName, lastName FROM Users"
             + "WHERE userName=?", readOnly=false, connected=false,
             tableName ="Users")
    DataSet<User> getUserByName(String userName);


}

        










Related examples in the same category

1.Use JDBC Chained Exception
2.Update annotation
3.The SQL script for creating the Employee Table