I'm attempting to create a JPA entity for a view. From the database layer, a table and a view should be the same.
However, problems begin to arise and they are two fold:
When attempting to setup the correct annotations. A view does not have a primary key associated with it, yet without the proper
@javax.persistence.Idannotated upon a field, you will get anorg.hibernate.AnnotationException: No identifier specified for entitythrown at Runtime.The Spring Boot
JpaRepositoryinterface definition requires that theIDtype extendsSerializable, which precludes utilizingjava.lang.Voidas a work-around for the lack of an id on an view entity.
What is the proper JPA/SpringBoot/Hibernate way to interact with a view that lacks a primary key?