Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate annotation: exclude a field

 
Edward Chen
Ranch Hand
Posts: 798
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In hibernate annotation, a class is declared as org.hibernate.annotations.Entity, how can I exclude a field so that it will NOT be mapped in database ? In traditional way, that is easy, we don't need write that field in hbm xml file.

Thanks.
 
Kuladip Yadav
Ranch Hand
Posts: 162
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use @Transient for that field, So it will not persist in to database.

Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic