File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Object Relational Mapping and the fly likes Hibernate annotation: exclude a field Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate annotation: exclude a field" Watch "Hibernate annotation: exclude a field" New topic

Hibernate annotation: exclude a field

Edward Chen
Ranch Hand

Joined: Dec 23, 2003
Posts: 798
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.

Kuladip Yadav
Ranch Hand

Joined: Jul 30, 2008
Posts: 162

You can use @Transient for that field, So it will not persist in to database.

I agree. Here's the link:
subject: Hibernate annotation: exclude a field
It's not a secret anymore!