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 ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

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

Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?

Anibal Gimenez Canicoba
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.

Can't .... do .... plaid .... So I did this tiny ad instead:
Thread Boost feature
    Bookmark Topic Watch Topic
  • New Topic