2

addSqlFunction()当我使用 hibernate.cfg.xml 文件配置休眠时,如何在 spring 中使用?或者有没有其他方法可以使用 group_concat?

4

1 回答 1

2

如果您使用 Spring 的 HibernateTemplate 与 Hibernate 集成,有一个简单的解决方案。覆盖 SpringLocalSessionFactoryBean并实现方法postProcessConfiguration

隧道尽头的光(config 是方法传递给你的对象postProcessConfiguration):

config.addSqlFunction( “group_concat”, new StandardSQLFunction("group_concat", new StringType());
于 2012-10-24T11:07:56.680 回答