Announcement Announcement Module
Collapse
No announcement yet.
How to use password() of mysql in Spring+Hibernate? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to use password() of mysql in Spring+Hibernate?

    Hi,
    For example, to use JDBC,the sql is "insert into tt_user (user_name,password) values('kavin',Password('kavin'))",
    but how can I do in Spring+Hibernate,since I want to encrpt the field of password.

    Thanks in advance
    Kavin

  • #2
    This is more a Hibernate question: may have come up before on their forums. A Hibernate Interceptor might help: it could call the Password function in the database, then change the password property value so that Hibernate would persist that value.

    Hibernate interceptors are useful for various advanced functionality, and are well supported in Spring. See the "entityInterceptor" property of LocalSessionFactoryBean.

    Comment


    • #3
      Definitely more of a Hibernate question, but you might also consider implementing a Hibernate UserType. More portable than the interceptor approach, although you have to manage the encryption yourself.

      Comment


      • #4
        Yes, a UserType is probably a better idea.

        Comment

        Working...
        X