Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.IOException;
- import java.sql.SQLException;
- import java.util.List;
- import java.util.Map;
- import org.apache.openjpa.jdbc.conf.JDBCConfiguration;
- import org.apache.openjpa.jdbc.meta.ReverseMappingTool;
- import org.apache.openjpa.lib.conf.ObjectValue;
- import org.apache.openjpa.lib.util.Options;
- public class MemReverseMappingTool extends ReverseMappingTool {
- private static final String MEM_REVERSE_MAPPER_CODE_MAP = "myReverseMapper.codeMap";
- private Map codeMap;
- public MemReverseMappingTool(JDBCConfiguration conf, Map outputMap) {
- super(conf);
- codeMap = outputMap;
- }
- protected static ReverseMappingTool newInstance(JDBCConfiguration conf) {
- Map map = (Map) conf.getValue(MEM_REVERSE_MAPPER_CODE_MAP).get();
- return new MemReverseMappingTool(conf, map);
- }
- @Override
- public List recordCode() throws IOException {
- return recordCode(codeMap);
- }
- public static boolean run(JDBCConfiguration conf, String[] args, Options opts, Map outputMap) throws IOException, SQLException {
- ObjectValue codeMapValue = new ObjectValue(MEM_REVERSE_MAPPER_CODE_MAP);
- codeMapValue.set(outputMap);
- conf.addValue(codeMapValue);
- return ReverseMappingTool.run(conf, args, opts);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment