I am working now in a very strange and obviously suboptimal environment. We are serving an application whose front end is AOL Instant Messenger. In AIM-Speak, we are a "bot" and we are served up under Tomcat.
In addition to this, our servers are, for some historical reason that remains unfathomable to me, not deployed in a data center, but exposed to the internet, and subject to all sorts of draconian security measures which, in a saner environment would be handled by SOAP over HTTPS or some other web-based solution. But that is not available to us, and since JDBC is not secure, the only place JDBC-enabled applications may run is on the database server's own machine. This requirement was not explained to me when I started, and introduced Hibernate for this project.
To get around this, this team had previously developed a homebrew socket-based system that sent all data to the database server box and JDBC-based application down an encrypted channel. I was able to modify this platform to work with Hibernate and thys gain the benefits of an ORM-based system, which I much prefer to work with. This used serialization and encryption to package the pojos, send them down the pipe, decryption and deserialization on the other end and then interacting with Hibernate. My modifications were successful and everyone was happy.
The architecture was then the Tomcat-served AIM application based on AOL's SDK talking over our encrypted/serialized "data channel" to a Hibernate-based java application on the database box.
All was well until we added some new features. These involved, for the first time, the use of Hibernate Sets of pojos within the mapping of an owning object. Previously, I had been able to get away with handling collections on the fly (no pojo owned collections of another pojo but sometimes lists were created on the fly on the server and passed through the "data channel" pipe.
This failed because the WebApp had been built to know nothing about Hibernate and it worked just fine that way. For some reason, though, the declaration of the Set in a mapping file now required that Hibernate jar be available to the web app so that it could deserialize the Set that was being passed to it. Without this, the runtime class of the Set being returned was unknown to the web application.
It was simple enough to add hibernate.jar to the Web Application, and this solved the matter, albeit at the cost of almost tripling the size of the WAR file. While this is a small matter, I am still wondering about why the application needs the hibernate.jar for Sets but not for Lists, and whether there is another solution to this minor, but interesting, problem.
|