I just tried to create a DB View using Hibernate Annotaions which looks like this
@Entity
@Subselect(value = "SELECT id, [..] FROM [] WHERE [..]")
@Synchronize({ "t1", "t2", "t3" })
public class SomeViewImpl implements SomeView {
@Id
protected String id;
[..]
Then I added it to the list of annotated classes in the sessionFactory (I’m using Spring) and try to run it.
I got no error and nothing, but the View is not created on the DB (actually a PostreSQL). Despite that I was not able to find something like that in the documentation, it may be that Hibernate is not supposed to create views in the DBs.
So the question I have: Is there a way to force Hibernate to create a View in my DB?
Unfortunately there is no way to let Hibernate create Views for you on the DB.
Our solution was to create the view manually on the DB