0

It is unclear how to use an entity to retrieve data from a user view.

see code below

import javax.persistence.Entity;
import javax.persistence.Table;
@Entity
@Table (name = "user1.view1")

No data is returned when performing a retrieval of data from the view.

Tim
  • 1
  • possibly duplicate of https://stackoverflow.com/questions/16686501/jpa-and-table-views-can-it-be-done? – Kishore Kirdat Jul 11 '19 at 14:01
  • If you're using the entity only to read the data, you should be able to use @Table annotation to point to a view. Ultimately ORM layer will just build a select query on the underlying view. Did you enable logging to print the generated SELECT query and check if it is correct? – Kishore Kirdat Jul 11 '19 at 14:05
  • The period after the user name ("dw") is converted to an underscore. The following is from the console output: Hibernate: select vwdimprogr0_.prgm_id as prgm_id1_0_, vwdimprogr0_.prgm_cd as prgm_cd2_0_, vwdimprogr0_.prgm_nm as prgm_nm3_0_ from dw_vw_dim_program vwdimprogr0_ – Tim Jul 14 '19 at 01:40

0 Answers0