Use Hibernate for XML marshalling or something else like Castor?
I have simple producer/consumer programs using JMS and sending POJOs. It was prototype. It is doing a simple XML marshalling and then posting JMS TextMessage to JMS topic for communication between producer/consumer. Objects are small like worst case 2-3kb and transfer rate will be about 7-10msg/sec. Now I have to do real thing and that means many more object types that need to be marshalled to XML before they can be send via JMS.
But I also have to persist data to DB. I am thinking of using Hibernate for this part. Many, but not all of object that will travel via JMS must also be persisted to DB using Hibernate. Since I have to map most of java classes to persist using Hibernate, then maybe I can map all of them and ask Hibermate to give me the marshalled XML so I can send via JMS?
Here is example of 2 classes simplified for post. Both have to be send via JMS, so they have to be XML marshall. ThermalReading class doesn't need persistance to DB, but Patient class needs tthat. Can/should I use Hinernate to get marshalled XML for both or use Hibernate only for Patient and something like Castor for ThermalReading :
class Patient { public Collection<int> getConditions(); public void setConditions(Collection<int> newConditions); }; class ThermalReading { public void setR18(double); public double getR18(); };
Thanks for help.
|