This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to define password column in hibernate

 
kwame Iwegbue
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does anyone know how to annotate a class or define in a hbm.xml file, an element that produces a password column- providing for encryption, (using hibernate3.2) similar to writing the following statement in SQL:



and then the following would insert encrypted password:



Thanks!!

The problem i'm having is with the PASSWORD() function. I can't seem to find its equivalent in hibernate or JPA
[ May 09, 2007: Message edited by: kwame Iwegbue ]
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"password" data type? Which database are you using? Sounds like a vendor-specific data type, if it is I'd keep this out of the mapping (just use a character type and encrypt the text).

In Hibernate you treat functions like they were named queries. Have a read of the docs on named queries for more info.
 
kwame Iwegbue
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Paul.
how do I encrypt the text. Its MySQL database
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic