• 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
  • Liutauras Vilda
  • Bear Bibeault
  • Junilu Lacar
  • Martin Vashko
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Scott Selikoff
  • salvin francis
  • Piet Souris

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

 
Ranch Hand
Posts: 92
  • 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: 4371
47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What version of Hibernate?
 
Andrey Dmitriev
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
  5.4.7
 
Dave Tolls
Master Rancher
Posts: 4371
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: 92
  • 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: 92
  • 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: 4371
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.
 
That new kid is a freak. Show him this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!