场景:
之前系统用mysql数据库,很多数据经过hibernate如此查出
[code="java"]
public List> getAllPortalPorletItemLstUnderWorkZoneSiteByWorkZoneSiteId(
final long projectId, final long orgRoleId,
final long workZoneSiteId) {
List> list = this.hibernateTemplate
.execute(new HibernateCallback>>() {
public List<Map<String, Object>> doInHibernate(
Session session) throws HibernateException,
SQLException {
List find = null;
String sql = "select t2.* , t1.title ,t1.showTitle, t1.type, t1.isLocal, t1.url,t1.maxUrl,t1.defaultHeight,t1.defaultWidth, t1.status "
+ "from portal_item as t1,portal_default_workzonesite_item as t2 "
+ "where t1.status=1 and t1.id=t2.portalItemId and t2.workZoneSiteId='"
+ workZoneSiteId
+ "' and t2.projectId='"
+ projectId
+ "' and t2.orgRoleId='"
+ orgRoleId + "'";
SQLQuery query = session.createSQLQuery(sql);
query
.setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP);
find = query.list();
return find;
}
});
return list;
}
[/code]
现在改为oracle之后,表字段全是大写,经过sql查出的放回Map中的key全是大写的, 这个一个Map要传递到action 甚至页面上, 之前key全是mysql中的数据字段(小写,有驼峰规则),现在全变成大写了。
请问,谁有好的解决经验,在DAO这层拿到Map时就把里面的key全转化成之前驼峰规则的key(mysql里的小写)值吗?? 您的回答,是我学习的动力,不甚感激!!