Created
February 25, 2009 03:44
-
-
Save 3gcodes/69985 to your computer and use it in GitHub Desktop.
This file contains 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
public class SqlMapBaseDao<T, ID extends Serializable> extends SqlMapClientDaoSupport implements Dao<T, ID> { | |
private Class<T> entityClass; | |
@Autowired | |
@SuppressWarnings("unchecked") | |
public void init(SqlMapClient sqlMapClient) { | |
entityClass = (Class<T>) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0]; | |
setSqlMapClient(sqlMapClient); | |
} | |
@SuppressWarnings("unchecked") | |
public SqlMapBaseDao() {} | |
@SuppressWarnings("unchecked") | |
public List<T> read() { | |
return getSqlMapClientTemplate().queryForList(entityClass.getSimpleName() + ".findAll"); | |
} | |
public T read(ID id) { | |
return null; | |
} | |
@SuppressWarnings("unchecked") | |
public void save(T t) { | |
getSqlMapClientTemplate().insert(entityClass.getSimpleName() + ".insert", t); | |
} | |
public void delete(T t) { | |
} | |
public T findBy(String fieldName, Object value) { | |
return null; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment