public static void main(String[] args) throws SQLException { DmCustomerExcellent dmCustomerExcellent = new DmCustomerExcellent(); Connection conn = getConnection(); Map<String, Class> map = new HashMap<>(); map.put("dm_customer_excellent", DmCustomerExcellent.class); String sql = "select * from dm_customer_excellent where rownum = 1 "; Class class1 = map.get("dm_customer_excellent"); try { Object testCustomerExcellent = class1.newInstance(); if(testCustomerExcellent instanceof DmCustomerExcellent){ DmCustomerExcellent tt = (DmCustomerExcellent)testCustomerExcellent; tt.setActperbusi2("-adfa-f--"); System.out.println(tt.getActperbusi2()); } } catch (InstantiationException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalAccessException e) { // TODO Auto-generated catch block e.printStackTrace(); } }