Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

view with hibernate

Tags:

hibernate

How to map a view with multiple entiites using Hibernate?

Regards, chaitu

like image 544
user569125 Avatar asked Feb 24 '11 22:02

user569125


1 Answers

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.

like image 139
jpkrohling Avatar answered Oct 11 '22 10:10

jpkrohling