0
package dao;
import java.sql.ResultSet;
import java.sql.SQLException;
import org.krams.tutorial.oxm.SubscriptionRequest;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.jdbc.core.simple.SimpleJdbcDaoSupport;
public class MyMapper implements RowMapper<SubscriptionRequest> {
public SubscriptionRequest mapRow(ResultSet rs, int rowNum) throws SQLException {
SubscriptionRequest subscription = new SubscriptionRequest();
subscription.setId(rs.getInt(1));
subscription.setCity(rs.getString(2));
return subscription;
}
}
這是我班的時刻,這是一個映射爲我的1臺的Java結果集的RowMapper
如何使用其他數據庫表一樣映射類? 或爲每個表,我必須創建新的映射類?