brsgrlr
brsgrlr

Reputation: 63

Hibernate time to first action - too slow

I started a new Java Spring Hibernate project. I only have a few POJO's for now. But hibernate's first actions (drop, create table etc.) happens too late, almost 30 seconds after project gets started.

Hibernate too slow

As I said, there isn't much of a code right now. I'm very new at Java web development and Hibernate. This is my application.properties:

spring.datasource.url=jdbc:oracle:thin:@//localhost:1521/xe
spring.datasource.username=system
spring.datasource.password=*****

spring.datasource.testWhileIdle=true
spring.datasource.validationQuery=SELECT 1

spring.jpa.show-sql=true

spring.jpa.hibernate.ddl-auto=create-drop

spring.jpa.hibernate.naming.physical-strategy=com.bmt311.dershane.CustomPhysicalNamingStrategy

spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.Oracle12cDialect

Upvotes: 0

Views: 1032

Answers (1)

Christian Beikov
Christian Beikov

Reputation: 16400

Why would you always recreate a database when developing locally? Oracle AFAIK does quite a lot of stuff(reserve diskspace etc.) when using DDL so it is generally a bad idea to use create-drop with Oracle. Try using spring.jpa.hibernate.ddl-auto=update instead for developing locally, or even better, use a dedicated tool for schema management like Liquibase or Flyway and use spring.jpa.hibernate.ddl-auto=none.

Upvotes: 2

Related Questions