@NotNull
public <T, M extends StaticDataDao<T>> List<T> selectAll(@NotNull
Class<M> aMapperType) {
final SqlSession mySession = theSessionFactory.openSession();
try {
final M myMapper = mySession.getMapper(aMapperType);
return myMapper.selectAll();
} finally {
mySession.close();
}
}
The trick here is that each dao MUST implement the selectAll in their
respective mapper xmls (or in their annotations) IFF (if and only if
for those that weren't comp sci majors) you have more than one mapper
already defining that method. Unless you are using it specifically
from the namespaces defined with the selectAlls
So to recap.
If I had 3 mappers A, B, C
And A had
<select id="selectAll" resultMap="SomeMap">
<include refid="findAllSQL"/> <!-- don't be too concerned with
the syntax here -->
</select>
In its namespace then it will work for ALL combinations of:
A.selectAll
B.selectAll
C.selectAll
selectAll
If I had A AND B mappers defined with that then it would be:
A.selectAll - works
B.selectAll - works
C.selectAll - FAILS
selectAll - FAILS
I had a semi related blog post on this subject
http://blog.chengin.com/?p=32