Hibernate, MySQL Views and hibernate.hbm2ddl.auto

2019-04-14 04:54发布

问题:

I can use MySQL views in Hibernate by treating them like tables - ie. the entity is no different than one created for a table. However my application won't deploy when Hibernate is set to validate the model as it can't find the View as it assumes it's a table.

Is it possible to use Hibernate Entities with deploy time validation turned on (hibernate.hbm2ddl.auto = validate)?

Thanks.

回答1:

There are several issues in JIRA about this (HHH-2018, HHH-1872, and HHH-1329) so this might clearly be a new one. My understanding is that the easiest workaround for now is to turn hbm2ddl off. If you think that your case is not covered by the existing issues (e.g. because you are using MySQL), maybe open a new one.