使用Hibernate,我尝试执行以下sql命令(在dbVisualizer的SQL命令中运行)
select positionreferenceedi.reference as "EDI",
position.datedepart as "datedepart",
positionadresseenlevement.raisonsociale as "raison sociale expéditeur",
positionadresselivraison.raisonsociale as "raison sociale destinataire",
positionadresselivraison.codepostal as "code postal",
positionadresselivraison.codepostal as "ville",
position.colis+position.palette as "colis",
position.poids+position.poidspalette as "poids",
position.pointagelibelle as "Statut",
substring(text(position.pointagedate) from 1 for 10) as "Date statut",
'' as "COM.",
'' as "CODE",
'' as "RESP EXT.",
'' as "RESP ZEUS",
'' as "RESP BIDON"
from position
left join positionadresse positionadresseenlevement on (positionadresseenlevement.idposition = position.id and positionadresseenlevement.typeadresse=0)
left join positionadresse positionadresselivraison on (positionadresselivraison.idposition = position.id and positionadresselivraison.typeadresse=1)
left join positionreference positionreferenceseq on (positionreferenceseq.idposition = position.id and positionreferenceseq.typereference='seq')
left join positionreference positionreferenceedi on (positionreferenceedi.idposition = position.id and positionreferenceedi.typereference='edi')
left join positionreference positionreferencecab on (positionreferencecab.idposition = position.id and positionreferencecab.typereference='cab')
left join positionreference positionreferencesst on (positionreferencesst.idposition = position.id and positionreferencesst.typereference='4edi')
where position.id in (:list) "
代码:
String queryString=getQueryFromDB(); // The query string is saved in a PostgreSQL table
Query query = session.createSQLQuery(queryString).setParameterList("list", idPositionList);
List list = query.list();
buildXLSFile(list);
Hibernates抛出以下异常" org.hibernate.MappingException:没有JDBC类型的Dialect映射:1111"在query.list()上(idPositionList是一个List);
如果我删除这些行 '' as" COM。", '' as" CODE", '' as" RESP EXT。", '' as" RESP ZEUS", '' as" RESP BIDON" 然后查询运行良好......
所以我猜Hibernate不接受空列,但我需要检索空列(除了标题)之外的信息,以便构建一个xls文件(用户将在稍后完成的那些特定空白列)在过程结束时。
主要思想是构建一个系统,每个用户都可以使用从我们的SI中的其他请求中获取的ID来运行预定义的请求。
是否有任何想法可以帮助我实现目标,而无需编码以便在正确的位置插入空白列?
感谢您的帮助!
劳伦
PS:对不起我的英文......