• 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
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

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

 
Ranch Hand
Posts: 123
  • 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....
 
Master Rancher
Posts: 4663
49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What version of Hibernate?
 
Andrey Dmitriev
Ranch Hand
Posts: 123
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
  5.4.7
 
Dave Tolls
Master Rancher
Posts: 4663
49
  • 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: 123
  • 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: 123
  • 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
Master Rancher
Posts: 4663
49
  • 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.
 
The moth suit and wings road is much more exciting than taxes. Or this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic