Relation not found error with play and postgres (w

2019-07-04 00:43发布

I have a table called ETL_TABLES which resides on the public schema. In my application.conf I have the following 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 ?

3条回答
放我归山
2楼-- · 2019-07-04 00:52

make sure you have set postgresql dialect:

jpa.dialect=org.hibernate.dialect.PostgreSQLDialect
查看更多
Melony?
3楼-- · 2019-07-04 01:06

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

查看更多
Luminary・发光体
4楼-- · 2019-07-04 01:08

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.

查看更多
登录 后发表回答