• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

There are difference between a view and a table from the point of view of Hibernate?

 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have a application that uses several tables, I would like to change one table for a view that contains the same columns and data types, must I to change the application code (hibernate mapping files, daos etc) or hibernate not disting a table from a view. Suppose that the table and the view are identical.

For example, I develop a application that use a table named APP_TABLE. The application is finished and works perfect, but one day I need to change the APP_TABLE for a view that contains the same data and types (maybe with additional columns but not revelavant)

Must I to change the existing application or the application can work with the view without touch any line of previous code??

Regards.
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yeray,
Yes. Hibernate can use views. Your view needs to be updatable if you are updating it. That sounds obvious, but some complex views are not updatable so it is something to consider.
 
Yeray Santana Borges
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Jeanne Boyarsk, thank you for your response,

but if I change a table in the data base for a view (with the same structure, colums and data type), can I use the same mapping file or need to change it for use a view ? I dont know if for Hibernate is the same use a view or a table. Consider the following task:

1) create a table and a hibernate mapping file for that table
2) develop an application that use this table
3) drop the table in database and create a view that has the same columns and data type, considere an updatable view
4) Can I use the old code with the view ??

Sorry for my english, thank you very much.
 
We noticed he had no friends. So we gave him this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic