【问题标题】:How to use group_concat in Hibernate + Spring如何在 Hibernate + Spring 中使用 group_concat
【发布时间】:2012-05-20 08:18:05
【问题描述】:

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

【问题讨论】:

标签: spring hibernate


【解决方案1】:

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

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

config.addSqlFunction( “group_concat”, new StandardSQLFunction("group_concat", new StringType());

【讨论】:

    猜你喜欢
    • 2011-06-24
    • 2011-04-10
    • 1970-01-01
    • 2012-01-21
    • 2015-03-24
    • 2011-01-14
    • 1970-01-01
    • 2015-08-20
    • 2014-03-16
    相关资源
    最近更新 更多