Nov 22nd, 2010, 05:06 PM
Spring, Hibernate, and aes_encrypt function in MySQL
Spring and Hibernate provided the way to insert a record into database via the save() method.
User() user = new User(int id, String name);
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,
Nov 22nd, 2010, 06:32 PM
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