Win a copy of Spark in Action this week in the Open Source Projects forum!
  • 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
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Problem trying to perform an insert operation in Postgresql with JPA(Hibernate)

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
My Application is using Hibernate as JPA implementation provider. When I try to persist a bean using the Entity Manager, I'm having a JDBC ERROR saying that the entity doesn't exist in postgresql. Due I have show_sql on true I saw the following query: "insert into my_entity.....", so I went to pgAdmin and tried to run the same query and had an error, then put the schema name before the entity and it worked. query: "insert into my_schema.my_entity....."

After some googling I found the "default_schema" prameter for the persistence.xml cofiguration file. I tried that without success.
Is there any way to include the scema on the queries?

Thanks!
Anibal
 
Anibal Gimenez Canicoba
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found a solution.

I had to remove the default_schema from my persistence.xml file and generate the model again. Now, the entities are generated on the public schema and the schema specification before the entity ( [my_schema].[my_entity] ) is not needed anymore.

It is not the ideal solution and of course the original question remains open.

Cheers
 
Can't .... do .... plaid .... So I did this tiny ad instead:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic