Spring Framework MappingSqlQuery - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework MappingSqlQuery class.

This code example shows how to use the following methods:compile, declareParameter, setDataSource, setSql
    private static final String DEF_GET_NEWID_QUERY = 
        "select paperid from legacyIDMap where legacyid=?"; 
     
    private class GetNew extends MappingSqlQuery { 
         
        public GetNew(DataSource dataSource) { 
            setDataSource(dataSource); 
            setSql(DEF_GET_NEWID_QUERY); 
            declareParameter(new SqlParameter(Types.INTEGER)); 
            compile(); 
        } //- GetNew.GetNew 
         
        public String mapRow(ResultSet rs, int rowNum) throws SQLException { 
            return rs.getString(1); 
        } //- GetNew.mapRow 
         
        public String run(int legacyID) { 
            List<String> list = execute(legacyID); 
            if (list.isEmpty()) { 
                return null; 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:compile, declareParameter, setDataSource, setSql
        "select id, userid, title, type, desc, params " + 
        "from feeds where userid=?"; 
     
    protected class GetFeeds extends MappingSqlQuery { 
         
        public GetFeeds(DataSource dataSource) { 
            setDataSource(dataSource); 
            setSql(DEF_GET_FEEDS_QUERY); 
            declareParameter(new SqlParameter(Types.VARCHAR)); 
            compile(); 
        } 
         
        public Feed mapRow(ResultSet rs, int rowNum) throws SQLException { 
            return mapFeed(rs); 
        } 
         
        public List<Feed> run(String userid) { 
            return execute(userid); 
        } 
         
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:compile, declareParameter, setDataSource, setSql
        "select id, size, incollection, cauth, ctitle, cvenue, cyear " + 
        "from clusters where incollection=1 order by size desc limit ?"; 
 
    private class GetInCol extends MappingSqlQuery { 
 
        public GetInCol(DataSource dataSource) { 
            setDataSource(dataSource); 
            setSql(DEF_GET_INCOL_QUERY); 
            declareParameter(new SqlParameter(Types.INTEGER)); 
            compile(); 
        } 
         
        public ThinDoc mapRow(ResultSet rs, int rowNum) throws SQLException { 
            return mapThinDoc(rs); 
        } 
         
        public List<ThinDoc> run(int amount) { 
            return execute(amount); 
        } 
    } 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:compile, declareParameter, setDataSource, setSql
    private static final String DEF_GET_TAGS_QUERY = 
        "select tag, count from tags where paperid=? order by count desc"; 
     
    private class GetTags extends MappingSqlQuery { 
         
        public GetTags(DataSource dataSource) { 
            setDataSource(dataSource); 
            setSql(DEF_GET_TAGS_QUERY); 
            declareParameter(new SqlParameter(Types.VARCHAR)); 
            compile(); 
        } //- GetTags.GetTags 
         
        public Tag mapRow(ResultSet rs, int rowNum) throws SQLException { 
            Tag tag = new Tag(); 
            tag.setTag(rs.getString(1)); 
            tag.setCount(rs.getInt(2)); 
            return tag; 
        } //- GetTags.mapRow 
         
        public List<Tag> run(String doi) { 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:compile, declareParameter, setDataSource, setSql
		//	"SELECT version FROM canname_versions WHERE cluster=? ORDER BY version DESC LIMIT 1"; 
		"SELECT max(version) FROM canname_versions WHERE cluster=?"; 
     
    private class GetMaxVersion extends MappingSqlQuery { 
         
        public GetMaxVersion(DataSource dataSource) { 
            setDataSource(dataSource); 
            setSql(DEF_GET_MAX_VERSION_QUERY); 
            declareParameter(new SqlParameter(Types.VARCHAR)); 
            compile(); 
        } //- GetMaxVersion.GetMaxVersion 
         
        public Object mapRow(ResultSet rs, int rowNum) throws SQLException { 
            return rs.getInt(1); 
        } //- GetMaxVersion.mapRow 
         
		// aid - author cluster 
        public int run(String aid) { 
            List<Integer> list = execute(aid); 
            if (list.isEmpty()) { 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:compile, declareParameter, getUsersByUsernameQuery
    /** 
     * Query object to look up a user. 
     */ 
    private class OcUsersByUsernameMapping extends MappingSqlQuery { 
        protected OcUsersByUsernameMapping(DataSource ds) { 
            super(ds, getUsersByUsernameQuery()); 
            declareParameter(new SqlParameter(Types.VARCHAR)); 
            compile(); 
        } 
 
        @Override 
        protected Object mapRow(ResultSet rs, int rownum) throws SQLException { 
            String username = rs.getString(1); 
            String password = rs.getString(2); 
            boolean enabled = rs.getBoolean(3); 
            boolean nonLocked = rs.getBoolean(4); 
            UserDetails user = new User(username, password, enabled, true, true, nonLocked, new GrantedAuthority[] { new GrantedAuthorityImpl("HOLDER") }); 
 
            return user; 
        } 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:compile, declareParameter
     
     
    class FriendsQuery extends MappingSqlQuery { 
 
        public FriendsQuery(DataSource dataSource) { 
            super(dataSource, GET_FRIENDS); 
            declareParameter(new SqlParameter(Types.VARCHAR)); 
            compile(); 
        } 
  
        protected Friend mapRow(ResultSet rs, int rowNum) throws SQLException { 
            Friend friend = new Friend(); 
            friend.setId(rs.getString("userid")); 
            friend.setFirstName(rs.getString("firstName")); 
            friend.setMiddleName(rs.getString("middleName")); 
            friend.setLastName(rs.getString("lastName")); 
            return friend; 
        } 
         
        public List<Friend> run(Account account) { 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:compile, setDataSource, setSql
     
	} 
 
	private class GetUniquePublicDocuments extends MappingSqlQuery { 
         
        	public GetUniquePublicDocuments(DataSource dataSource) { 
            		setDataSource(dataSource); 
            		setSql(DEF_GET_UNIQUE_PUBLIC_DOCS); 
            		compile(); 
       		} 
         
        	public Long mapRow(ResultSet rs, int rowNum) throws SQLException { 
            		return rs.getLong(1); 
        	} 
         
        	public Long run() { 
            		List list = execute(); 
            		if (list.isEmpty()) { 
                		return null; 
            		} else { 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:declareParameter
import org.springframework.jdbc.object.MappingSqlQuery; 
 
public class CustomerMappingSqlQuery extends MappingSqlQuery<Customer> { 
	 
	public CustomerMappingSqlQuery(DataSource dataSource) { 
		super(dataSource, "select CUST_ID, NAME, AGE from customer where CUST_ID = ?"); 
		super.declareParameter(new SqlParameter("id", Types.INTEGER)); 
        compile(); 
	} 
	 
	@Override 
	protected Customer mapRow(ResultSet rs, int rowNum) throws SQLException { 
		Customer customer = new Customer(); 
		customer.setCustId(rs.getInt("CUST_ID")); 
		customer.setName(rs.getString("NAME")); 
		customer.setAge(rs.getInt("AGE")); 
		return customer; 
	} 
 
} 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:compile, declareParameter
        "select paperid from tags where userid=? and tag=?"; 
     
    protected class GetDoisMapping extends MappingSqlQuery { 
         
        public GetDoisMapping(DataSource ds) { 
            super(ds, DEF_GET_DOIS_QUERY); 
            declareParameter(new SqlParameter(Types.VARCHAR)); 
            declareParameter(new SqlParameter(Types.VARCHAR)); 
            compile(); 
        } //- GetDoisMapping.GetDoisMapping 
         
        protected String mapRow(ResultSet rs, int rownum) throws SQLException { 
            return rs.getString("paperid"); 
        } //- GetDoisMapping.mapRow 
 
        public List<String> run(Account account, String tag) { 
            Object[] params = new Object[] { account.getUsername(), tag }; 
            return execute(params); 
        } //- GetDoisMapping.run 
         
5
CodeRank
Experience pair programming with AI  Get Codota for Java