How to map a view with multiple entiites using Hibernate?
Regards, chaitu
See the section 5.1.3 "Class", in the Hibernate documentation, right before the section "Id":
There is no difference between a view and a base table for a Hibernate mapping. This is transparent at the database level, although some DBMS do not support views properly, especially with updates. Sometimes you want to use a view, but you cannot create one in the database (i.e. with a legacy schema).
http://docs.jboss.org/hibernate/core/3.5/reference/en/html/mapping.html#mapping-declaration-class
There's also an example on how to do that using XML.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With