@Test public void testFindId() throws Exception { IDataSet db = database( support.loadFlatXmlDataStream(getClass(), "user.xml") ); support.cleanInsert(support.getConnection(tx), db); tx.commit(); Integer userId = 1; UserProfile result = dao.find(userId); assertNotNull(result); assertEquals(userId, result.getId()); }
@Override public UserProfile find(int userId) { DBRecord r = new DBRecord(); try { r.read(table, userId, getConnection()); UserProfile user = new UserProfile(); r.getBeanProperties(user); return user; } catch (RecordNotFoundException ex) { return null; } finally { r.close(); } }
EmpireUserDao extends EmpireDao implements UserDao { @Override public UserProfile find(int userId) { DBRecord r = new DBRecord(); try { r.read(table, userId, getConnection()); UserProfile user = new UserProfile(); r.getBeanProperties(user); return user; } catch (RecordNotFoundException ex) { return null; } finally { r.close(); } } }
EmpireUserDao extends EmpireDao implements UserDao { @Override public UserProfile find(int userId) { DBRecord r = new DBRecord(); try { r.read(table, userId, getConnection()); UserProfile user = new UserProfile(); r.getBeanProperties(user); return user; } catch (RecordNotFoundException ex) { return null; } finally { r.close(); } } EmpireUserDao(ProarcDatabase db); }
EmpireUserDao extends EmpireDao implements UserDao { @Override public UserProfile find(int userId) { DBRecord r = new DBRecord(); try { r.read(table, userId, getConnection()); UserProfile user = new UserProfile(); r.getBeanProperties(user); return user; } catch (RecordNotFoundException ex) { return null; } finally { r.close(); } } EmpireUserDao(ProarcDatabase db); @Override UserProfile create(); @Override void update(UserProfile user); @Override UserProfile find(int userId); @Override List<UserProfile> find(String userName, String passwd, String remoteName, String remoteType); }
EmpireUserDao extends EmpireDao implements UserDao { @Override public UserProfile find(int userId) { DBRecord r = new DBRecord(); try { r.read(table, userId, getConnection()); UserProfile user = new UserProfile(); r.getBeanProperties(user); return user; } catch (RecordNotFoundException ex) { return null; } finally { r.close(); } } EmpireUserDao(ProarcDatabase db); @Override UserProfile create(); @Override void update(UserProfile user); @Override UserProfile find(int userId); @Override List<UserProfile> find(String userName, String passwd, String remoteName, String remoteType);  }