改之前:
Query query=this.dao.getSession().createSQLQuery("select 'd:/copy' as target_path from core_file").setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP);
改之后:
Query query=this.dao.getSession().createSQLQuery("select cast ( 'd:/copy' as varchar) as target_path from core_file").setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP);
结论:
自定义的字段要加上类型转换。