This content has been marked as final.
Show 2 replies
-
1. Re: how to access mysql view from hibernate query?
mroeoesli Aug 18, 2009 4:25 PM (in response to navintamil)yes this is possible:
check
Hibernate Docand
Hibernate Doc
(chapter 2.3.2. Mapping native queries)Greetz Marco
-
2. Re: how to access mysql view from hibernate query?
daxxy Aug 18, 2009 6:39 PM (in response to navintamil)I just used seam-gen to generate entities and views and it treated the MySQL view the same as a table. It worked just fine. The only thing I had to do was explicitly specify a primary key in my reverse engineering file, seam-gen.reveng.xml.
Like this:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-reverse-engineering SYSTEM "http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd" > <hibernate-reverse-engineering> <table name="office_view"> <primary-key> <key-column name='office_id' /> </primary-key> </table> </hibernate-reverse-engineering>