spring-data-jpa Hibernate多次执行更新查询,实体实际上未保存

voase2hg  于 2022-11-10  发布在  Spring
关注(0)|答案(1)|浏览(140)

我有一个实体与下一个字段:

@Entity
@TypeDef(name = "jsonb", typeClass = JsonBinaryType.class)
public class Area extends CreatedDateAuditedEntity {

@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "area_seq")
@SequenceGenerator(name = "area_seq", sequenceName = "area_seq", allocationSize = 1)
@Column(name = "a_id", unique = true, updatable = false, nullable = false)
private Long id;

@Type(type = "jsonb")
@Column(name = "meter_readings", columnDefinition = "jsonb")
private List<AreaMeterReading> meterReadings = new ArrayList<>();

其余的栏目被省略了,因为它们有很多,我不认为它们是相关的。
当我更新meterReadings字段,然后调用repository.save()时,它在本地工作,但在我们的开发环境中它不工作。我在Hibernate日志中看到,对该实体的更新执行了多次,前1次或2次使用新值,然后几次使用旧值,如下所示:

2022-08-11 11:40:39.874 DEBUG 6 --- [nio-8081-exec-1] c.z.main.core.service.area.AreaService   : Saved area 1373 with meter_reading values - [AreaMeterReading{meterId='MeterId1', meterReading=100}]
2022-08-11 11:40:39.874 DEBUG 6 --- [nio-8081-exec-1] c.z.m.c.service.queue.ProducerService    : Sending message to exchange=zpot-test, queue=common-cost-reorganization-test and for property with ID = 1234
2022-08-11 11:40:39.876 DEBUG 6 --- [nio-8081-exec-1] .m.c.s.c.CommonCostReorganizationService : Sent common cost reorganization message for property with ID=1234
2022-08-11 11:40:39.876 DEBUG 6 --- [nio-8081-exec-1] org.hibernate.SQL                        : select section0_.s_id as s_id1_35_0_, section0_.created_at as created_2_35_0_, section0_.a_id as a_id7_35_0_, section0_.erp_code as erp_code3_35_0_, section0_.name as name4_35_0_, section0_.p_id as p_id8_35_0_, section0_.reference_code as referenc5_35_0_, section0_.removed_at as removed_6_35_0_ from main.section section0_ where section0_.s_id=? and ( section0_.removed_at IS NULL)
2022-08-11 11:40:39.877 TRACE 6 --- [nio-8081-exec-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [1] as [BIGINT] - [557]
2022-08-11 11:40:39.878 DEBUG 6 --- [ntContainer#0-1] c.z.m.c.service.queue.ConsumerService    : Received cost participation reorganization message for property with ID=1234 and action date=2022-08-11 to process
2022-08-11 11:40:39.879 DEBUG 6 --- [nio-8081-exec-1] org.hibernate.SQL                        : select attachment0_.a_id as a_id7_22_0_, attachment0_.ma_id as ma_id1_22_0_, attachment0_.ma_id as ma_id1_22_1_, attachment0_.created_at as created_2_22_1_, attachment0_.a_id as a_id7_22_1_, attachment0_.default_image as default_3_22_1_, attachment0_.file_id as file_id4_22_1_, attachment0_.p_id as p_id8_22_1_, attachment0_.reference_type as referenc5_22_1_, attachment0_.removed_at as removed_6_22_1_ from main.main_attachment attachment0_ where attachment0_.a_id=?
2022-08-11 11:40:39.880 DEBUG 6 --- [ntContainer#0-1] org.hibernate.SQL                        : select property0_.p_id as p_id1_28_, property0_.created_at as created_2_28_, property0_.actual_usage as actual_u3_28_, property0_.a_id as a_id37_28_, property0_.autocalculate_areas as autocalc4_28_, property0_.bank as bank5_28_, property0_.bnr as bnr6_28_, property0_.common_costs as common_c7_28_, property0_.common_costs_per_m2 as common_c8_28_, property0_.contract_number as contract9_28_, property0_.created_by as created10_28_, property0_.erp_code as erp_cod11_28_, property0_.exclusive_area as exclusi12_28_, property0_.gnr as gnr13_28_, property0_.internal_key as interna14_28_, property0_.land_area as land_ar15_28_, property0_.name as name16_28_, property0_.op_costs as op_cost17_28_, property0_.organization_id as organiz18_28_, property0_.post_a_id as post_a_38_28_, property0_.property_tax as propert19_28_, property0_.purchase_date as purchas20_28_, property0_.purchase_price as purchas21_28_, property0_.reference_code as referen22_28_, property0_.removed_at as removed23_28_, property0_.rented_area as rented_24_28_, property0_.sale_date as sale_da25_28_, property0_.sale_price as sale_pr26_28_, property0_.snr as snr27_28_, property0_.status as status28_28_, property0_.takeover_date as takeove29_28_, property0_.total_building_area as total_b30_28_, property0_.turnover_reporting as turnove31_28_, property0_.type as type32_28_, property0_.vat_coverage as vat_cov33_28_, property0_.vat_type as vat_typ34_28_, property0_.with_vat as with_va35_28_, property0_.year_built as year_bu36_28_ from main.property property0_ where property0_.p_id=? and (property0_.removed_at is null)
2022-08-11 11:40:39.881 TRACE 6 --- [ntContainer#0-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [1] as [BIGINT] - [1234]
2022-08-11 11:40:39.882 TRACE 6 --- [nio-8081-exec-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [1] as [BIGINT] - [1373]
2022-08-11 11:40:39.883 DEBUG 6 --- [ntContainer#0-1] org.hibernate.SQL                        : select sections0_.p_id as p_id8_35_0_, sections0_.s_id as s_id1_35_0_, sections0_.s_id as s_id1_35_1_, sections0_.created_at as created_2_35_1_, sections0_.a_id as a_id7_35_1_, sections0_.erp_code as erp_code3_35_1_, sections0_.name as name4_35_1_, sections0_.p_id as p_id8_35_1_, sections0_.reference_code as referenc5_35_1_, sections0_.removed_at as removed_6_35_1_ from main.section sections0_ where ( sections0_.removed_at IS NULL) and sections0_.p_id=?
2022-08-11 11:40:39.884 TRACE 6 --- [ntContainer#0-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [1] as [BIGINT] - [1234]
2022-08-11 11:40:39.884 DEBUG 6 --- [nio-8081-exec-1] org.hibernate.SQL                        : select areaaderro0_.ad_id as ad_id1_2_0_, areaaderro0_.e_name as e_name2_2_0_, areaaderro0_.e_value as e_value3_2_0_, areaaderro0_.e_level as e_level4_2_0_, areaaderro0_.message as message5_2_0_, areaaderro0_.status as status6_2_0_ from main.area_ad_error areaaderro0_ where areaaderro0_.ad_id=?
2022-08-11 11:40:39.885 TRACE 6 --- [nio-8081-exec-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [1] as [BIGINT] - [1326]
2022-08-11 11:40:39.885 DEBUG 6 --- [ntContainer#0-1] org.hibernate.SQL                        : select areas0_.s_id as s_id36_1_0_, areas0_.a_id as a_id1_1_0_, areas0_.a_id as a_id1_1_1_, areas0_.created_at as created_2_1_1_, areas0_.ad_id as ad_id35_1_1_, areas0_.area_height as area_hei3_1_1_, areas0_.bathroom as bathroom4_1_1_, areas0_.cleaning_area as cleaning5_1_1_, areas0_.comment as comment6_1_1_, areas0_.common_area as common_a7_1_1_, areas0_.common_for as common_f8_1_1_, areas0_.divisible_area as divisibl9_1_1_, areas0_.end_date as end_dat10_1_1_, areas0_.erp_code as erp_cod11_1_1_, areas0_.exclusive_area as exclusi12_1_1_, areas0_.floor as floor13_1_1_, areas0_.furnished as furnish14_1_1_, areas0_.gross_circumference as gross_c15_1_1_, areas0_.inclusive_area as inclusi16_1_1_, areas0_.inventory_list as invento17_1_1_, areas0_.kitchen as kitchen18_1_1_, areas0_.market_price as market_19_1_1_, areas0_.meter_readings as meter_r20_1_1_, areas0_.name as name21_1_1_, areas0_.net_circumference as net_cir22_1_1_, areas0_.parking_spaces_number as parking23_1_1_, areas0_.property_type as propert24_1_1_, areas0_.reference_code as referen25_1_1_, areas0_.removed_at as removed26_1_1_, areas0_.rent_option as rent_op27_1_1_, areas0_.rooms_number as rooms_n28_1_1_, areas0_.s_id as s_id36_1_1_, areas0_.special_condition as special29_1_1_, areas0_.stalls_number as stalls_30_1_1_, areas0_.start_date as start_d31_1_1_, areas0_.status as status32_1_1_, areas0_.at_id as at_id37_1_1_, areas0_.vat_reporting as vat_rep33_1_1_, areas0_.vat_type as vat_typ34_1_1_ from main.area areas0_ where areas0_.s_id=?
2022-08-11 11:40:39.886 TRACE 6 --- [ntContainer#0-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [1] as [BIGINT] - [557]
2022-08-11 11:40:39.890 DEBUG 6 --- [ntContainer#0-1] org.hibernate.SQL                        : select areatype0_.at_id as at_id1_6_0_, areatype0_.created_at as created_2_6_0_, areatype0_.name as name3_6_0_, areatype0_.organization_id as organiza4_6_0_, areatype0_.removed_at as removed_5_6_0_, areatype0_.class as class6_6_0_ from main.area_type areatype0_ where areatype0_.at_id=?
2022-08-11 11:40:39.891 TRACE 6 --- [ntContainer#0-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [1] as [BIGINT] - [5400]
2022-08-11 11:40:39.892 DEBUG 6 --- [ntContainer#0-1] org.hibernate.SQL                        : select areatype0_.at_id as at_id1_6_0_, areatype0_.created_at as created_2_6_0_, areatype0_.name as name3_6_0_, areatype0_.organization_id as organiza4_6_0_, areatype0_.removed_at as removed_5_6_0_, areatype0_.class as class6_6_0_ from main.area_type areatype0_ where areatype0_.at_id=?
2022-08-11 11:40:39.892 TRACE 6 --- [ntContainer#0-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [1] as [BIGINT] - [5390]
2022-08-11 11:40:39.893 DEBUG 6 --- [nio-8081-exec-1] org.hibernate.SQL                        : update main.area set ad_id=?, area_height=?, bathroom=?, cleaning_area=?, comment=?, common_area=?, common_for=?, divisible_area=?, end_date=?, erp_code=?, exclusive_area=?, floor=?, furnished=?, gross_circumference=?, inclusive_area=?, inventory_list=?, kitchen=?, market_price=?, meter_readings=?, name=?, net_circumference=?, parking_spaces_number=?, property_type=?, reference_code=?, removed_at=?, rent_option=?, rooms_number=?, special_condition=?, stalls_number=?, start_date=?, status=?, at_id=?, vat_reporting=?, vat_type=? where a_id=?
2022-08-11 11:40:39.894 TRACE 6 --- [nio-8081-exec-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [1] as [BIGINT] - [1326]
2022-08-11 11:40:39.894 DEBUG 6 --- [ntContainer#0-1] org.hibernate.SQL                        : select areatype0_.at_id as at_id1_6_0_, areatype0_.created_at as created_2_6_0_, areatype0_.name as name3_6_0_, areatype0_.organization_id as organiza4_6_0_, areatype0_.removed_at as removed_5_6_0_, areatype0_.class as class6_6_0_ from main.area_type areatype0_ where areatype0_.at_id=?
2022-08-11 11:40:39.895 TRACE 6 --- [ntContainer#0-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [1] as [BIGINT] - [5399]
2022-08-11 11:40:39.895 TRACE 6 --- [nio-8081-exec-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [2] as [NUMERIC] - [null]
2022-08-11 11:40:39.895 TRACE 6 --- [nio-8081-exec-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [3] as [BOOLEAN] - [false]
2022-08-11 11:40:39.896 TRACE 6 --- [nio-8081-exec-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [4] as [NUMERIC] - [null]
2022-08-11 11:40:39.897 DEBUG 6 --- [ntContainer#0-1] org.hibernate.SQL                        : select settlement0_.sp_id as sp_id1_36_, settlement0_.created_at as created_2_36_, settlement0_.common_costs_updated_at as common_c3_36_, settlement0_.end_date as end_date4_36_, settlement0_.p_id as p_id8_36_, settlement0_.start_date as start_da5_36_, settlement0_.status as status6_36_, settlement0_.year as year7_36_ from main.settlement_period settlement0_ where settlement0_.p_id=? and settlement0_.year=? and extract(MONTH FROM settlement0_.start_date)=? and settlement0_.status<>?
2022-08-11 11:40:39.898 TRACE 6 --- [ntContainer#0-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [1] as [BIGINT] - [1234]
2022-08-11 11:40:39.898 TRACE 6 --- [ntContainer#0-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [2] as [INTEGER] - [2022]
2022-08-11 11:40:39.899 TRACE 6 --- [nio-8081-exec-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [5] as [VARCHAR] - [null]
2022-08-11 11:40:39.899 TRACE 6 --- [ntContainer#0-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [3] as [INTEGER] - [8]
2022-08-11 11:40:39.899 TRACE 6 --- [nio-8081-exec-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [6] as [NUMERIC] - [0]
2022-08-11 11:40:39.899 TRACE 6 --- [ntContainer#0-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [4] as [VARCHAR] - [SUBMITTED]
2022-08-11 11:40:39.900 TRACE 6 --- [nio-8081-exec-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [7] as [VARCHAR] - [null]
2022-08-11 11:40:39.900 TRACE 6 --- [nio-8081-exec-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [8] as [BOOLEAN] - [true]
2022-08-11 11:40:39.901 TRACE 6 --- [nio-8081-exec-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [9] as [DATE] - [2023-12-31]
2022-08-11 11:40:39.901 TRACE 6 --- [nio-8081-exec-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [10] as [VARCHAR] - [null]
2022-08-11 11:40:39.901 TRACE 6 --- [nio-8081-exec-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [11] as [NUMERIC] - [100]
2022-08-11 11:40:39.902 TRACE 6 --- [nio-8081-exec-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [12] as [SMALLINT] - [1]
2022-08-11 11:40:39.902 TRACE 6 --- [nio-8081-exec-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [13] as [BOOLEAN] - [false]
2022-08-11 11:40:39.902 TRACE 6 --- [nio-8081-exec-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [14] as [NUMERIC] - [null]
2022-08-11 11:40:39.902 TRACE 6 --- [nio-8081-exec-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [15] as [NUMERIC] - [100]
2022-08-11 11:40:39.903 TRACE 6 --- [nio-8081-exec-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [16] as [VARCHAR] - [null]
2022-08-11 11:40:39.903 TRACE 6 --- [nio-8081-exec-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [17] as [BOOLEAN] - [true]
2022-08-11 11:40:39.903 TRACE 6 --- [nio-8081-exec-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [18] as [NUMERIC] - [null]
2022-08-11 11:40:39.904 TRACE 6 --- [nio-8081-exec-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [19] as [OTHER] - [[AreaMeterReading{meterId='MeterId1', meterReading=100}]]
2022-08-11 11:40:39.904 TRACE 6 --- [nio-8081-exec-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [19] as [OTHER] - [[AreaMeterReading{meterId='MeterId1', meterReading=100}]]
2022-08-11 11:40:39.904 TRACE 6 --- [nio-8081-exec-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [20] as [VARCHAR] - [Test area 1]
2022-08-11 11:40:39.905 TRACE 6 --- [nio-8081-exec-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [21] as [NUMERIC] - [null]
2022-08-11 11:40:39.905 TRACE 6 --- [nio-8081-exec-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [22] as [INTEGER] - [null]
2022-08-11 11:40:39.905 TRACE 6 --- [nio-8081-exec-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [23] as [VARCHAR] - [null]
2022-08-11 11:40:39.907 TRACE 6 --- [nio-8081-exec-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [24] as [VARCHAR] - [null]
2022-08-11 11:40:39.907 TRACE 6 --- [nio-8081-exec-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [25] as [TIMESTAMP] - [null]
2022-08-11 11:40:39.908 TRACE 6 --- [nio-8081-exec-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [26] as [VARCHAR] - [null]
2022-08-11 11:40:39.908 TRACE 6 --- [nio-8081-exec-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [27] as [INTEGER] - [null]
2022-08-11 11:40:39.908 TRACE 6 --- [nio-8081-exec-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [28] as [VARCHAR] - [null]
2022-08-11 11:40:39.908 TRACE 6 --- [nio-8081-exec-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [29] as [INTEGER] - [null]
2022-08-11 11:40:39.909 TRACE 6 --- [nio-8081-exec-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [30] as [DATE] - [2022-01-01]
2022-08-11 11:40:39.909 TRACE 6 --- [nio-8081-exec-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [31] as [VARCHAR] - [OCCUPIED]
2022-08-11 11:40:39.909 TRACE 6 --- [nio-8081-exec-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [32] as [BIGINT] - [5399]
2022-08-11 11:40:39.909 TRACE 6 --- [nio-8081-exec-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [33] as [BOOLEAN] - [true]
2022-08-11 11:40:39.909 TRACE 6 --- [nio-8081-exec-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [34] as [VARCHAR] - [COMPLIANT]
2022-08-11 11:40:39.910 TRACE 6 --- [nio-8081-exec-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [35] as [BIGINT] - [1373]
2022-08-11 11:40:39.917 DEBUG 6 --- [ntContainer#0-1] org.hibernate.SQL                        : update main.area set ad_id=?, area_height=?, bathroom=?, cleaning_area=?, comment=?, common_area=?, common_for=?, divisible_area=?, end_date=?, erp_code=?, exclusive_area=?, floor=?, furnished=?, gross_circumference=?, inclusive_area=?, inventory_list=?, kitchen=?, market_price=?, meter_readings=?, name=?, net_circumference=?, parking_spaces_number=?, property_type=?, reference_code=?, removed_at=?, rent_option=?, rooms_number=?, special_condition=?, stalls_number=?, start_date=?, status=?, at_id=?, vat_reporting=?, vat_type=? where a_id=?
2022-08-11 11:40:39.917 TRACE 6 --- [ntContainer#0-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [1] as [BIGINT] - [1326]
2022-08-11 11:40:39.918 TRACE 6 --- [ntContainer#0-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [2] as [NUMERIC] - [null]
2022-08-11 11:40:39.918 TRACE 6 --- [ntContainer#0-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [3] as [BOOLEAN] - [false]
2022-08-11 11:40:39.918 TRACE 6 --- [ntContainer#0-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [4] as [NUMERIC] - [null]
2022-08-11 11:40:39.918 TRACE 6 --- [ntContainer#0-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [5] as [VARCHAR] - [null]
2022-08-11 11:40:39.918 TRACE 6 --- [ntContainer#0-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [6] as [NUMERIC] - [0.00]
2022-08-11 11:40:39.918 TRACE 6 --- [ntContainer#0-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [7] as [VARCHAR] - [null]
2022-08-11 11:40:39.918 TRACE 6 --- [ntContainer#0-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [8] as [BOOLEAN] - [true]
2022-08-11 11:40:39.918 TRACE 6 --- [ntContainer#0-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [9] as [DATE] - [2023-12-31]
2022-08-11 11:40:39.918 TRACE 6 --- [ntContainer#0-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [10] as [VARCHAR] - [null]
2022-08-11 11:40:39.918 TRACE 6 --- [ntContainer#0-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [11] as [NUMERIC] - [100.00]
2022-08-11 11:40:39.918 TRACE 6 --- [ntContainer#0-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [12] as [SMALLINT] - [1]
2022-08-11 11:40:39.918 TRACE 6 --- [ntContainer#0-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [13] as [BOOLEAN] - [false]
2022-08-11 11:40:39.919 TRACE 6 --- [ntContainer#0-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [14] as [NUMERIC] - [null]
2022-08-11 11:40:39.919 TRACE 6 --- [ntContainer#0-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [15] as [NUMERIC] - [100.00]
2022-08-11 11:40:39.919 TRACE 6 --- [ntContainer#0-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [16] as [VARCHAR] - [null]
2022-08-11 11:40:39.919 TRACE 6 --- [ntContainer#0-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [17] as [BOOLEAN] - [true]
2022-08-11 11:40:39.919 TRACE 6 --- [ntContainer#0-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [18] as [NUMERIC] - [null]
2022-08-11 11:40:39.919 TRACE 6 --- [ntContainer#0-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [19] as [OTHER] - [[AreaMeterReading{meterId='MeterId1', meterReading=300}]]
2022-08-11 11:40:39.919 TRACE 6 --- [ntContainer#0-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [19] as [OTHER] - [[AreaMeterReading{meterId='MeterId1', meterReading=300}]]
2022-08-11 11:40:39.919 TRACE 6 --- [ntContainer#0-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [20] as [VARCHAR] - [Test area 1]
2022-08-11 11:40:39.919 TRACE 6 --- [ntContainer#0-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [21] as [NUMERIC] - [null]
2022-08-11 11:40:39.919 TRACE 6 --- [ntContainer#0-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [22] as [INTEGER] - [null]
2022-08-11 11:40:39.919 TRACE 6 --- [ntContainer#0-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [23] as [VARCHAR] - [null]
2022-08-11 11:40:39.919 TRACE 6 --- [ntContainer#0-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [24] as [VARCHAR] - [null]
2022-08-11 11:40:39.919 TRACE 6 --- [ntContainer#0-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [25] as [TIMESTAMP] - [null]
2022-08-11 11:40:39.919 TRACE 6 --- [ntContainer#0-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [26] as [VARCHAR] - [null]
2022-08-11 11:40:39.919 TRACE 6 --- [ntContainer#0-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [27] as [INTEGER] - [null]
2022-08-11 11:40:39.919 TRACE 6 --- [ntContainer#0-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [28] as [VARCHAR] - [null]
2022-08-11 11:40:39.919 TRACE 6 --- [ntContainer#0-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [29] as [INTEGER] - [null]
2022-08-11 11:40:39.919 TRACE 6 --- [ntContainer#0-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [30] as [DATE] - [2022-01-01]
2022-08-11 11:40:39.920 TRACE 6 --- [ntContainer#0-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [31] as [VARCHAR] - [OCCUPIED]
2022-08-11 11:40:39.920 TRACE 6 --- [ntContainer#0-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [32] as [BIGINT] - [5399]
2022-08-11 11:40:39.920 TRACE 6 --- [ntContainer#0-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [33] as [BOOLEAN] - [true]
2022-08-11 11:40:39.920 TRACE 6 --- [ntContainer#0-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [34] as [VARCHAR] - [COMPLIANT]
2022-08-11 11:40:39.920 TRACE 6 --- [ntContainer#0-1] o.h.type.descriptor.sql.BasicBinder      : binding parameter [35] as [BIGINT] - [1373]

其中,[AreaMeterReading{meterId='MeterId1', meterReading=100}]是字段的新值,[AreaMeterReading{meterId='MeterId1', meterReading=300}]是旧值。执行更新后检查数据库时,在表中看到旧值。
我不能调试它的属性,因为我重复-它不会发生在本地,只在我们的开发环境。我测试了它在同一分支,没有其他可观察到的差异,我们的环境。
为什么一个更新会发生多次,是不是有什么bug?

wnavrhmk

wnavrhmk1#

调试了2天,无意中发现了一个解决方案,我们使用hibernate-types库Mapjsonb字段,日志中有一个警告:

[2m2022-08-11 12:18:32.709[0;39m [33m WARN[0;39m [35m8[0;39m [2m---[0;39m [2m[           main]
[0;39m [36mHibernate Types                         [0;39m [2m:[0;39m The class 
com.zpot.main.data.entity.area.AreaMeterReading class should override both the equals and hashCode methods
 based on the JSON object value it represents!

我覆盖了equals和hashcode,它开始工作,不确定没有它们不工作的原因是什么。

相关问题