如何在 Hibernate + Spring 中使用 group_concat

2024-02-18

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


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

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

config.addSqlFunction( “group_concat”, new StandardSQLFunction("group_concat", new StringType());
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何在 Hibernate + Spring 中使用 group_concat 的相关文章

随机推荐