Posts

China Strategy to Social Media - Great Decision

The (most) Chinese do not use Facebook but have their own social network e.g.  http://renren.com . The government strategy to discourage Facebook.com (by banning or somehow else) resulted into great saving of national reserve. How? When we advertise things on Facebook, we pay money directly to Facebook. Even when our target market is local. All this money goes out of the country. If there is a national social network (e.g. in case of China), it will not go out. China did same for the micro blogging platform (e.g. twitter.com) by making  http://weibo.com .

How to Get Map Collection using Spring Jdbc Template

I wanted to access Map collection using Spring JdbcTemplate, but the method jdbcTemplate.queryForMap(...) returns a single Map instance (i.e. Map with only one Entry). Here is how I proceeded to extract Map with multiple entries. 1. Define a MapExtracter class public class MapExtractor implements ResultSetExtractor { public Object extractData(ResultSet rs) throws SQLException, DataAccessException { Map map = new LinkedHashMap(); while (rs.next()) { Integer key = rs.getInt("id"); String value = rs.getString("name"); map.put(key, value); } return map; } } 2. Use the MapExtracter class with a simple JdbcTemplate as follows: Map map = (Map)getJdbcTemplate().query( "SELECT id, name FROM business WHERE type_id=10", new MapExtractor()); The returned map is a collection of multiple entries.