• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Paul Clapham
  • Devaka Cooray
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Knute Snortum
  • Liutauras Vilda
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Piet Souris
Bartenders:
  • salvin francis
  • Carey Brown
  • Frits Walraven

PSQLException: ERROR: syntax error at or near "with"

 
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
    Greetings to all!

    I try to insert data in table by using Spring Data JPA + Hibernate.
   
    Before I created table


  And populate with:


  Entity:


   
   repository-class:




   I pass as a genIntColumn-parameter the following: new GenIntColumn(null, 3, 2, 3).   Null-value for id, because this data in table does not exist yet.
   

   But log return:



   As I know, JpaRepository.save-method enable to generate id, while inserting data, if id does not exist, and inserts (updates) values by id, if id exists.
  When I realise UPDATE by this method, everything is well: method updates value, although move the updated row to the end of sequence....
 
Rancher
Posts: 4549
47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What version of Hibernate?
 
Andrey Dmitriev
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
  5.4.7
 
Dave Tolls
Rancher
Posts: 4549
47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a vague recollection that there were issues around Postgres sequences and Hibernate.

Could you use an IDENTITY strategy instead, or does it have to be a SEQUENCE?
 
Andrey Dmitriev
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
     I have tried IDENTITY-strategy, but with the same result...
 
Andrey Dmitriev
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
  I have found the solution.
  I commented  "<entry key="#{T(org.hibernate.cfg.AvailableSettings).DIALECT}" value="org.hibernate.dialect.SQLServerDialect"/>" in spring-configuation. And now test passing successfully!
  But the reason of success I understand only intuitively yet
 
Dave Tolls
Rancher
Posts: 4549
47
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
value="org.hibernate.dialect.SQLServerDialect"

Your database (at least from the exception) is a Postgres one, not a SQLServer one.
That's why it wasn't working.
 
He was giving me directions and I was powerless to resist. I cannot resist this tiny ad:
Two software engineers solve most of the world's problems in one K&R sized book
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic