Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HibernateException when validating mapping to MATERIALIZED VIEW in postgresql 9.3

How can I map object to materialized view and keep <prop key="hibernate.hbm2ddl.auto">validate</prop>?

When launch webapp, I get this exception on startup:

Caused by: org.hibernate.HibernateException: Missing table: subjects_lp at org.hibernate.cfg.Configuration.validateSchema(Configuration.java:1302) at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaValidator.java:155) at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:512) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1797) ...

According to sources, it looks like hibernate asks only for types "VIEW" and "TABLE" in DatabaseMetadata#getTableMetadata, while postgresql stores it like "MATERIALIZED VIEW" (checked with plain jdbc).

Surprisingly, I couldn't find in google some info about this error. Is there way to keep hibernate validation on startup, maybe there is way to keep one table/entity unvalidated?

Hibernate version: 4.2.12.Final
Postgresql driver: 9.3-1101-jdbc41

Entity doesn't have any specific annotation, only

@javax.persistence.Entity @javax.persistence.Table(name = "table_name", schema = "schema")

like image 704
astafev.evgeny Avatar asked Jan 15 '15 14:01

astafev.evgeny


1 Answers

It's not a driver problem, it's a hibernate bug.

See this bug https://hibernate.atlassian.net/browse/HHH-9602

like image 178
user2435612 Avatar answered Sep 22 '22 03:09

user2435612