-2

I'm working on creating Materialized View, but I'm using JPA as ORM. One way to create a Materialized view is by using native sql query. But I have to create a Materialized View using JPQL or using Criteria Query. Is it possible? If it is, then please share how to do that?

Bhupendra
  • 11
  • 1

1 Answers1

0

Materialized views are not supported by any means in JPA. You have to resort to plain SQL if you want to create them from your application.

It is only possible to map a way to an entity. But if your view is read-only, you should take care that you do not try to update entities, or even better, make every field of the entity updatable=false, insertable=false.

OndroMih
  • 7,280
  • 1
  • 26
  • 44