User1230321
User1230321

Reputation: 1475

How to design multiple views for the same table in spring data jpa

I have some event table whose data keeps getting changed everyday. I want to design a view for every month/every fixed number of days. When I want to create a new view, I want to append the end date to the name of the previous view. I'm supposed to go with views only, since that is the requirement I'm given. My views contain the records of that month or those many days. My table will contain all the columns that are in the original table. I've several questions here:

  1. How to programmatically create views in Spring data jpa?
  2. How can I rename the view names in Spring data jpa?

I've found the link to handle views https://glenware.wordpress.com/2015/12/15/creating-custom-spring-data-jpa-repositories/

Upvotes: 0

Views: 618

Answers (1)

farrellmr
farrellmr

Reputation: 1905

How to programmatically create views in Spring data jpa?

The blog post you included shows you how to map to views. I get the impression you want this to be dynamic - but i dont think this is possible. It may be possible using some fancy cglib - but i dont think its practical

How can I rename the view names in Spring data jpa?

Not possible except through recompiling

I think your best bet is to write queries, or a native query

Upvotes: 1

Related Questions