I have a table called ETL_TABLES which resides on the public schema. In my application.conf I have the follow开发者_StackOverflow社区ing line:
hibernate.default_schema=public
that should mean the search_path of postgres is set to the public schema.
I have a class Tables
, with the @Table(name="ETL_TABLES")
annotation.
But when I try to access the entity class, for example by
Tables.findAll();
then the error says relation "public.etl_tables"
does not exist.
The table is present on the postgres public schema, so what am I doing wrong here ?
make sure you have set postgresql dialect:
jpa.dialect=org.hibernate.dialect.PostgreSQLDialect
I ran into this problem and turns out that hibernate doesn't like mapped table names in entity by default (I am sure there is some configuration somewhere to override this !). So It can't find the relation 'Article' but will find 'article' or 'ARTICLE'. Hope this helps folks who come to this thread
Apperently in our configuration I need to write this when creating an entity:
@Table(name="\"ETL_TABLES\"")
So I have to use \" to represent the double quotes needed in the select.
精彩评论