JPA and Table Views. Can it be done? [duplicate]

For more info on JPA and database views see, http://en.wikibooks.org/wiki/Java_Persistence/Advanced_Topics#Views

In JPA you can map to a VIEW the same as a table, using the @Table annotation. You can then map each column in the view to your object’s attributes. Views are normally read-only, so object’s mapping to views are normally also read-only. In most databases views can also be updatable depending on how complex to query is that they encapsulate. Even for complex queries database triggers can normally be used to update into the view.

Leave a Comment