Announcement Announcement Module
Collapse
No announcement yet.
Spring, Hibernate, and aes_encrypt function in MySQL Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring, Hibernate, and aes_encrypt function in MySQL

    Hi all,

    Spring and Hibernate provided the way to insert a record into database via the save() method.
    Ex:
    User() user = new User(int id, String name);
    userDAO.save(user);

    which is great.
    However I am stuck at this:
    I need to execute this query to insert a record to the table user
    SQL query: "insert into user values("My name", AES_ENCRYPT("clear_txt", "key"));
    Just for example: My table user has two fields: 'name', and 'password'. The password needed to encrypt with some key. AES_ENCRYPT is a function in MySQL.

    How do I do this the Hibernate way?
    I had looked around and seem like Hibernate doesn't has the insert query.

    If this is not the right way to do it, how do you deal with a requirement to encrypt a field in database with provided key?

    Thanks in advance,

    Thai

  • #2
    Well, my first question would be:
    How did you end up on the Spring Integration forum with an Hibernate question?

    Hope it'll save you some time

    Comment

    Working...
    X