gpt4 book ai didi

java - hibernate ,别名

转载 作者:塔克拉玛干 更新时间:2023-11-03 05:19:38 26 4
gpt4 key购买 nike

我注意到每次我尝试访问同一个表时,hibernate 都会为相同的列生成不同的别名:

Hibernate: select person0_.id as id0_0_, person0_.nam as nam0_0_, person0_.fam as fam0_0_, person0_.otc as otc0_0_ from web_db.Person person0_ where person0_.id=?
Hibernate: select person0_.id as id4_0_, person0_.nam as nam4_0_, person0_.fam as fam4_0_, person0_.otc as otc4_0_ from web_db.Person person0_ where person0_.id=?

有没有办法让 hibernate 模式为相同的查询生成相同的别名?例如:

Hibernate: select person0_.id as id0_0_, person0_.nam as nam0_0_, person0_.fam as fam0_0_, person0_.otc as otc0_0_ from web_db.Person person0_ where person0_.id=?
Hibernate: select person0_.id as id0_0_, person0_.nam as nam0_0_, person0_.fam as fam0_0_, person0_.otc as otc0_0_ from web_db.Person person0_ where person0_.id=?

最佳答案

看看HHH-2448它涵盖了这个主题,并且有一个用于确定性别名生成的补丁。

关于java - hibernate ,别名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1815413/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com