Postgresql 保存实体时出现Utf 8问题
我将SpringBoot2与jpa、hibernate和postgres一起使用 在我的身材里,格雷德尔,我有 tasks.withType(JavaCompile){Postgresql 保存实体时出现Utf 8问题,postgresql,hibernate,spring-boot,jpa,character-encoding,Postgresql,Hibernate,Spring Boot,Jpa,Character Encoding,我将SpringBoot2与jpa、hibernate和postgres一起使用 在我的身材里,格雷德尔,我有 tasks.withType(JavaCompile){ options.compilerArgs=[“-Xlint:unchecked”、“-Xlint:deprecation”、“-parameters”] options.encoding=“UTF-8” } 我在这里贴了一些课程 我对utf8有问题 在调试中我看到了 select nextval ('ig
options.compilerArgs=[“-Xlint:unchecked”、“-Xlint:deprecation”、“-parameters”]
options.encoding=“UTF-8”
} 我在这里贴了一些课程 我对utf8有问题 在调试中我看到了
select
nextval ('ignar.hibernate_sequence')
Hibernate:
select
nextval ('ignar.samples_id_seq')
Hibernate:
insert
into
ignar.samplings
(available_for_test, build_date, color_id, dimension_id, machine_id, print, product_id, reception_date, remark, special_try, test_done, to_print, delay_before_doing_test, press, quantity_received, dtype, id, year)
values
(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 'TraditionalSamplings', ?, ?)
Hibernate:
insert
into
ignar.samples
(created_at, updated_at, absorption_printed, aen_remarque, certificat_include, cube, durability_printed, fresh_density, fresh_weigth, gen_remarque, label, position, sample_letter, sampling_id, sampling_year, absorption, absorption_number, coloration, coloration_number, compression, compression_number, density, draw_down, draw_down_number, durability, durability_number, granulometry, granulometry_number, organic_material, organic_material_number, scaling, scaling_number, id)
values
(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
2018-05-21 15:38:21.214 WARN 2973 --- [io-8080-exec-10] o.h.engine.jdbc.spi.SqlExceptionHelper : SQL Error: 0, SQLState: 22021
2018-05-21 15:38:21.215 ERROR 2973 --- [io-8080-exec-10] o.h.engine.jdbc.spi.SqlExceptionHelper : ERROR: invalid byte sequence for encoding "UTF8": 0x00
2018-05-21 15:38:21.215 ERROR 2973 --- [io-8080-exec-10] o.h.i.ExceptionMapperStandardImpl : HHH000346: Error during managed flush [org.hibernate.exception.DataException: could not execute statement]
可能是您的字符导致了问题。。。尝试将其转换为java文件中的字符串为什么您认为这是UTF-8问题?如t所写:错误:编码“UTF8”的字节序列无效:0x00这意味着您试图通过期望字节解码为UTF-8的内容从数据库中输入非UTF-8数据不知道我是否可以使用字符。。。但是用一根绳子。。那工作