try{  con = getConnection(); ps = con.prepareStatement("select COUNT(*) from UserData where " + query.getQueryString());  rs = ps.executeQuery();  if(rs.next()){ count = rs.getInt(1); } debug("<checkForHardTokenProfileId()"); return count > 0;
try {  con = JDBCUtil.getDBConnection(JNDINames.DATASOURCE); ps = con.prepareStatement("select COUNT(*) from UserData where " + query.getQueryString());  rs = ps.executeQuery();  if (rs.next()) { count = rs.getInt(1); } debug("<checkForHardTokenProfileId()"); return count > 0;
	public boolean checkForHardTokenProfileId(Admin admin, int profileid){		debug(">checkForHardTokenProfileId()");		Connection con = null;		PreparedStatement ps = null;		ResultSet rs = null;		int count = 1; // return true as default.		Query query = new Query(Query.TYPE_USERQUERY);		query.add(UserMatch.MATCH_WITH_TOKEN, BasicMatch.MATCH_TYPE_EQUALS, Integer.toString(profileid));		try{		   // Construct SQL query.			con = getConnection();			ps = con.prepareStatement("select COUNT(*) from UserData where " + query.getQueryString());			// Execute query.			rs = ps.executeQuery();			// Assemble result.			if(rs.next()){			  count = rs.getInt(1);			}			debug("<checkForHardTokenProfileId()");			return count > 0;		}catch(Exception e){		  throw new EJBException(e);		}finally{            JDBCUtil.close(con, ps, rs);		}	} // checkForHardTokenProfileId