Created
August 27, 2011 17:34
-
-
Save 0xRoch/1175634 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public void get(final Object obj) { | |
List<Object> res = null; | |
try { | |
Class<?> clazz = obj.getClass(); | |
ClassInfo info = ClassInfo.getClassInfo(clazz); | |
final String[] fields = new String[info.updateFields.size()]; | |
for (int i = 0; i < info.updateFields.size(); i++) { | |
fields[i] = ClassInfo.getColumnNames(info.updateFields.get(i))[0]; | |
} | |
final String key = info.tableName + ":" + Util.readField(obj, info.getIdField()); | |
System.out.println("getting " + key); | |
res = jedis().multi(new TransactionBlock() { | |
@Override | |
public void execute() throws JedisException { | |
hmget(key, fields).get(); | |
} | |
}); | |
} finally { | |
RedisMappingUtils.fillModel(obj, res); | |
returnJedis(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment