hibernate

Spring Boot JPA saveAll() inserting to database extremely slowly

二次信任 提交于 2020-08-10 22:13:28
问题 I am using Spring Boot in conjunction with Hibernate to create the RESTful API for a simple web app where I read a .csv file and insert each row into a mysql database table. I am able to successfully do this but it's taking a very long time for any large csv file. I understand that it's better to batch my insert statements to reduce number of transactions but I don't think I am making that happen with the current code I have. This is what I currently am doing (which works but very slowly):

Logback配置文件这么写,还愁不会整理日志?

佐手、 提交于 2020-08-10 20:24:34
摘要: 1.日志输出到文件并根据 LEVEL 级别将日志分类保存到不同文件 2.通过异步输出日志减少磁盘 IO 提高性能 3.异步输出日志的原理 1、配置文件logback-spring.xml SpringBoot 工程自带 logback 和 slf4j 的依赖,所以重点放在编写配置文件上,需 要引入什么依赖,日志依赖冲突 统统都不需要我们管了。 logback 框架会默认加载 classpath 下命名为 logback-spring.xml 或 logback.xml 的配置文件。 如果将所有日志都存储在一个文件中,文件大小也随着应用的运行越来越大并且不好排查问题,正确的做法应该是将 error 日志和其他日志分开,并且不同级别的日志根据时间段进行记录存储。 配置文件: <? xml version="1.0" encoding="UTF-8" ?> < configuration debug ="true" > <!-- 项目名称 --> < property name ="PROJECT_NAME" value ="project-api" /> <!-- 定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径 --> < property name ="LOG_HOME" value ="logs" /> <!-- 控制台输出 --> < appender

Caused by: java.lang.IllegalArgumentException: Property 'driverClassName' must not be empty

陌路散爱 提交于 2020-08-10 19:27:26
问题 In the code I have shared here Exception in thread "restartedMain" java.lang.reflect.InvocationTargetException Caused by: java.lang.NullPointerException I am getting new error. Could you please help me with this. org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'springLogging3Application': Unsatisfied dependency expressed through field 'factory'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating

Stack overflow error for hibernate one-to-one mapping with Spring Data JPA

有些话、适合烂在心里 提交于 2020-08-10 19:22:16
问题 My problem is similar to this one https://discourse.hibernate.org/t/hibernate-throws-org-hibernate-id-identifiergenerationexception-attempted-to-assign-id-from-null-one-to-one-property/1777 but I am getting a different exception after applying the answer from this thread. My entities: @Entity @Table(name = "location") public class Location { @Id private Long id; @Column(name = "country_code") private String countryCode; private Double longitude; private Double latitude; @OneToOne(fetch =

Stack overflow error for hibernate one-to-one mapping with Spring Data JPA

吃可爱长大的小学妹 提交于 2020-08-10 19:21:35
问题 My problem is similar to this one https://discourse.hibernate.org/t/hibernate-throws-org-hibernate-id-identifiergenerationexception-attempted-to-assign-id-from-null-one-to-one-property/1777 but I am getting a different exception after applying the answer from this thread. My entities: @Entity @Table(name = "location") public class Location { @Id private Long id; @Column(name = "country_code") private String countryCode; private Double longitude; private Double latitude; @OneToOne(fetch =

Stack overflow error for hibernate one-to-one mapping with Spring Data JPA

拜拜、爱过 提交于 2020-08-10 19:20:14
问题 My problem is similar to this one https://discourse.hibernate.org/t/hibernate-throws-org-hibernate-id-identifiergenerationexception-attempted-to-assign-id-from-null-one-to-one-property/1777 but I am getting a different exception after applying the answer from this thread. My entities: @Entity @Table(name = "location") public class Location { @Id private Long id; @Column(name = "country_code") private String countryCode; private Double longitude; private Double latitude; @OneToOne(fetch =

Can't generate table from entity on Spring boot :( [closed]

ⅰ亾dé卋堺 提交于 2020-08-10 19:19:02
问题 Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 13 days ago . Improve this question Please help, i'm so hopeless. Although my application run without error but it still can't generate table:( There are my project structure : this is file pom.xml <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema

Can't generate table from entity on Spring boot :( [closed]

戏子无情 提交于 2020-08-10 19:16:31
问题 Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 13 days ago . Improve this question Please help, i'm so hopeless. Although my application run without error but it still can't generate table:( There are my project structure : this is file pom.xml <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema

Bean validation on associations not working when using generation strategy IDENTITY

ⅰ亾dé卋堺 提交于 2020-08-10 19:14:04
问题 I have got the following Parent, Child and Subchild entities: @Entity public class Parent { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "ID", nullable = false, precision = 20) private Long id; @Valid @BatchSize(size = 5) @OneToMany(cascade = CascadeType.ALL, orphanRemoval = true, mappedBy = "parent") private List<Child> childs = new ArrayList<>(); ... } @Entity public class Child { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "ID", nullable

Hibernate hbm2ddl.auto配置的可能值是什么,它们做了什么

≡放荡痞女 提交于 2020-08-10 18:01:34
问题: I really want to know more about the update, export and the values that could be given to hibernate.hbm2ddl.auto 我真的想知道更多关于更新,导出和可以给 hibernate.hbm2ddl.auto 的值的更多信息 I need to know when to use the update and when not? 我需要知道何时使用更新,何时不知道? And what is the alternative? 还有什么选择? These are changes that could happen over DB: 这些是可能发生在DB上的变化: new tables 新表 new columns in old tables 旧表中的新列 columns deleted 列已删除 data type of a column changed 列的数据类型已更改 a type of a column changed its attributes 列的类型更改了其属性 tables dropped 桌子掉了 values of a column changed 列的值已更改 In each case what is the best solution? 在每种情况下