• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to create HBM files for VIEW's

 
Kartik Tal
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi am using hibernate with SQL database, am able to create hbm files for tables and am able to interact with them successfully.
But the problem is with VIEW am having a view table which is not having any Primary keys, so how to create hmb file for that?
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You will need to define a primary key for your view; just include a surrogate key in its definition. If you cannot do that you will need to use the partial workaround of defining a composite key comprising every field in the view.

If your view has not been created as an updatable view I would not map it at all - just use a SQL query.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic