gpt4 book ai didi

java - hibernate 查询中的 clazz_ 属性

转载 作者:塔克拉玛干 更新时间:2023-11-02 19:17:57 28 4
gpt4 key购买 nike

在 Hibernate 表中,每个具体类策略在使用父类(super class)提取时生成以下查询:

SELECT vehicle0_.VEHICLE_ID    AS VEHICLE_ID1_2_,
vehicle0_.MANUFACTURER AS MANUFACTURER2_2_,
vehicle0_.PASSENGER_CAPACITY AS PASSENGER_CAPACITY1_0_,
vehicle0_.LOAD_CAPACITY AS LOAD_CAPACITY1_1_,
vehicle0_.clazz_ AS clazz_
FROM
(SELECT VEHICLE_ID,
MANUFACTURER,
PASSENGER_CAPACITY,
NULL AS LOAD_CAPACITY,
1 AS clazz_
FROM PassengerVehicle
UNION ALL
SELECT VEHICLE_ID,
MANUFACTURER,
NULL AS PASSENGER_CAPACITY,
LOAD_CAPACITY,
2 AS clazz_
FROM TransportationVehicle
) vehicle0_

vehicle0_.clazz_ 是在表中和类中都没有的查询中选择的,这个 clazz_ 属性是什么?

最佳答案

这就是继承鉴别器

当您将子类与父类(super class)结合在一起时,请避免在从结果集实例化时发生混淆,hibernate 在内部使用列 'clazz'

关于java - hibernate 查询中的 clazz_ 属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32517025/

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