• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem involving partitioned table + Spring Boot: GenerationTarget encountered exception accepting

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm working with partitioned tables using Postgres and Spring Boot. I managed to create the partition, and in the tests I performed, the GET and POST methods are working as intended.

However, I need help resolving the following error that occurs when I start the application:

GenerationTarget encountered exception accepting command : Error executing DDL "create table example (date_cd date not null, id int4 not null, name varchar(255), primary key (date_cd, id))" via JDBC Statement org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL "create table example (date_cd date not null, id int4 not null, name varchar(255), primary key (date_cd, id))" via JDBC Statement at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:67) ~[hibernate-core-5.4.32.Final.jar:5.4.32.Final]

The step-by-step of what I did before the error appeared:

I created the main Model, which will reference the partitioned table:



I created the composite ID class:



And then I started the application, everything ran normally.

After that I paused the application and partitioned the 'example' table following the Postgres documentation: https://www.postgresql.org/docs/current/ddl-partitioning.html Thread: 5.11.2.1. Example

And my table looks like this:



So I started the application again, and the following error was printed in the Spring Boot log:



My application.properties looks like this:



I know that changing 'spring.jpa.hibernate.ddl-auto' to 'none' would solve the problem, however it's not the solution I want as I don't want to manually manage all the database changes.
 
Yago Romualdo Vieira
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I managed to solve it by updating Spring Boot to the latest version and adding the following dependency in pom.xml:

<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>6.2.3.Final</version>
</dependency>
 
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch and thank you for telling us the solution. That solution will be useful if anybody else ever has the same problem.
 
reply
    Bookmark Topic Watch Topic
  • New Topic