【发布时间】:2012-05-20 08:18:05
【问题描述】:
当我使用 hibernate.cfg.xml 文件配置休眠时,如何在春季使用addSqlFunction()?或者有没有其他方法可以使用 group_concat?
【问题讨论】:
当我使用 hibernate.cfg.xml 文件配置休眠时,如何在春季使用addSqlFunction()?或者有没有其他方法可以使用 group_concat?
【问题讨论】:
如果您使用 Spring 的 HibernateTemplate 与 Hibernate 集成,有一个简单的解决方案。覆盖 Spring 的 LocalSessionFactoryBean 并实现方法 postProcessConfiguration。
隧道尽头的光(config是postProcessConfiguration方法传递给你的对象):
config.addSqlFunction( “group_concat”, new StandardSQLFunction("group_concat", new StringType());
【讨论】: