More on Hibernate

Sunday, January 27, 2008

I got some flack a few months back when I posted an article about poor scalability when using Hibernate for a proof of concept I was working on at the time. For that particular project it seems that Hibernate probably wasn't the best fit. However, I've now had the opportunity to use Hibernate on another project and my experience has been much better this time. First of all, the productivity benefits of using Hibernate rather than writing Spring JDBC code are quite impressive. I was able to get a prototype web application up and running in just a couple of hours with Hibernate because I really did only have to focus on the business logic rather than writing low level code. Scalability isn't at all critical for this application since it will not have a huge number of users but I ran some tests anyway to compare one of the transactions with a hand-coded JDBC equivalent. Here are the results:

JDBC versus Hibernate

It's true - Hibernate does add some overhead to the transaction but it's a price I'm happy to pay for the time saved in development. I expect there are other transactions in the system where Hibernate will be faster than JDBC due to caching.

I still stand by my previous conclusion, which is that it is always worth benchmarking products/technologies against real use cases to make sure they are suitable choices. One size does not fit all.

Labels: , ,


Sun to buy MySQL for $1 billion

Wednesday, January 16, 2008

I just heard that Sun are acquiring MySQL for around $1 billion. The press release is here.

Labels:


Sending extended character sets with OpenSMPP

Friday, January 4, 2008

There's astonishingly little documentation on the web about sending international characters in SMS messages using OpenSMPP (which is based on the Logica SMPP API). After a bit of research and some experimentation I've established that the following steps are required:

1. data_coding must be set to 0x08 (instructs the SMSC to use UCS-2 encoding - see section 5.2.19 in the SMPP protocol specification for other data codings)
2. When setting the message content, it must be encoded with UTF16

Here's some partial source code to demonstrate the point:

SubmitSM request = new SubmitSM();
request.setDataCoding( 0x08 ); // UCS-2
request.setShortMessage( messageText, Data.ENC_UTF16 );

It's worth noting that the maximum message length is reduced from 160 characters to 70 characters when using UCS-2.