Spring taking time to run

Viewed 44

I have a spring boot application when i start run its takes time to load it's stuck at

org.hibernate.dialect.PostgreSQLDialect

After researching I found a solution to make it fast to put this in properties

spring.jpa.properties.hibernate.temp.use_jdbc_metadata_defaults=false

Now run is faster but insert statements not working i am getting this error

ERROR: currval(): currval of sequence "some_id_seq" is not yet defined in this session

How to resolve this?

either i should solve slowness at startup or resolve insert issue

1 Answers

Hibernate tries to use global id generator for postgres. to fix this error you need to disable id-generator mapping through properties file. eg:

spring:
    jpa:
        show-sql: true
        properties:
          hibernate:
            dialect: org.hibernate.dialect.PostgreSQLDialect
        hibernate:
          use-new-id-generator-mappings: false
Related