On Friday, April 13, 2012 9:51:52 PM UTC+2, Christian MICHON wrote:
>
> Hi,
>
> I need to detect repetitions and updates in (relatively) small H2 tables.
>
> As such, I currently implemented using ruby and an external ORM a md5sum 
> calculation of all the keys concatenated into a string following their 
> natural order, which is stored back into a specific key.
>
> This involves a lot of communication with the H2 server, and I wish to 
> have it done natively (using java itself).
> (...)
>
>
After many experiments, I finally cracked it.

Sharing it here, in case someone else finds this useful one day...

CREATE ALIAS MD5 FOR 
"org.apache.commons.codec.digest.DigestUtils.md5Hex(java.lang.String)";
CREATE TABLE TEST(ID IDENTITY, NAME VARCHAR(255), MD5 VARCHAR(32) AS 
MD5(NAME));
INSERT INTO TEST (NAME) VALUES('The quick brown fox jumps over the lazy 
dog');
SELECT * FROM TEST ORDER BY ID;

Really powerful tool this H2 db... Congratulations again...

Christian 

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/h2-database/-/UV44utlLiAYJ.
To post to this group, send email to h2-database@googlegroups.com.
To unsubscribe from this group, send email to 
h2-database+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.

Reply via email to