• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Yeray Santana Borges
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • 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.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35279
384
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • 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
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic