Results 1 to 2 of 2

Thread: Spring, Hibernate, and aes_encrypt function in MySQL

Hybrid View

  1. #1
    Join Date
    Nov 2010
    Posts
    2

    Default 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. #2
    Join Date
    Jun 2010
    Location
    Paris
    Posts
    106

    Default

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •