Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to prevent the saving of one property of an entity in the datbase

 
Gourav Bansal
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am creating a application where I am integrated the spring and hibernate. So it's the User Registration Page basically. On this page I have password and confirm password property. I have created a entity class which is also act a model of spring. Now when I fetched the properties values and populate the Entity object and when I tring to save it it says "no confirm password column in user table".

Is their any way I can skip this property.

Thanks,
Gourav
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65335
97
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Personally, I would not be using the same class as both the ORM Model and the View Model. You're likely to come up with many more occasions where the needs of the view are different than the needs of the persistence model.

But, if you ignore that advice, look for an annotation that will allow the column to be ignored.
 
Jana reddyMadam
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess we can annotate with @Transient on the property getConfirmPassword.. to avoid looking for mapping column.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic