[jboss-user] [Beginners Corner] - Getting rebooted: migration from Middlegen to Hibernate/EJB

mjhammel do-not-reply at jboss.com
Wed Dec 19 12:41:07 EST 2007


Though I've delivered a product with JBOSS already, I'm still confused enough about the whole web services world that I have to consider these beginner questions.  Confused enough that I'm not sure exactly what questions to ask, so that's why I'm in here.  Please forgive the long winded post.

What I've currently got is a JBOSS based web services product that uses Middlegen to generate (based on the MySQL schema I defined) what I believe are EJB2.1 Local and Home classes that handle db access for me.  I have server side code that calls those classes that is instantiated via a web services (actually two) IMPL class.  The IMPL classes are accessed via remote stand-alone Java clients (not browsers) using WSDL interfaces (and JAX-RPC) that are generated for me using java2wsdl and wsdl2java.    All this works and actually works quite well.  The product is a grid system (poorly architected) for the government.  The next version (much better grid architecture) is about to begin development.

The problem for me is that the build system (partially inherited) generates code for me.  I come from C/Linux/Unix and have never had anything generate code for me.  I hate it cuz I don't understand what it's generating, even if I do understand how to use the generated code.  This becomes more of an issue now as I try to migrate off of Middlegen - which I understand is being abandoned and does not support EJB3, correct? - and move to Hibernate - which I understand offers similar functionality but for EJB3.  

I guess the first question would be do I really want to migrate from Middlegen to Hibernate?  It would seem I do if I want EJB3, which it would seem I need to keep up with current technologies (I already deteremined that EJB's are *necessary* based on the criteria in the JBOSS at Work text).  So will Hibernate generate classes for me like Middlegen did?  I've read a few dozen web sites and a bunch of books and I'm still not sure how to map the Home/Local api's to whatever Hibernate's generated classes will provide.  I sort of know *how* to use Hibernate (a legacy snippet of code in the Ant build that existed before I inherited this project points me in that direction), but I'm not really sure *what* hibernate will do when I use it.  I'm also concerned that I'll have to rewrite all the Home/Local code to use a new API for EJB3, but that's mostly busy work once I learn the API.

WSDL is another problem.  It's a bunch of XML configuration stuff that defines how I can pass data via the RPC calls I use.  At the moment, since it's generated for me, it's limited to the shape of the db schema.  I can't, for example, define a new class that lets me embed multiple rows from different tables and pass it in a single call (which would save roundtrip transfers).  I know it *can* be done.  I just don't know how to do it.  I'm also wondering if WSDL will be of much use if I switch to asynchronous communication using only JMS since many of the requests posted to the server from the clients can take a long time to complete, including things like file transfers.  JMS (directly, or possibly via Mule) is expected play a much bigger role in the next version of the product.

I'm coming to grips with terminology though it seems "framework" is heavily overused and poorly defined.  I can build JARs, WARs (which we no longer need since we don't provide a browser based interface) and EARs.  RARs popped up recently and I'm trying to figure out why those need their own format.  I'm completely comfortable using Javadoc API documentation and taught myself Java, Ant and SWT (for the clients) enough to build both ends of the product.  (Side note:  I use cscope and vi for development - IDEs give me a headache).  I'm still trying to find documentation on which parts of the stock JBOSS distribution I *should* remove (there are lots of examples that I don't think I should be shipping with the product, right?) when packaging thought that's slowly getting clearer to me.  XML configuration is a pain - not because of the format but because there is far too much configuration before you can even get applications running (the WSDL stuff is probably the worst example).  I guess writing config files doesn't seem like writing code to me.  I'll get over that eventually.  It would appear that EJB3 is supposed to address some of that issue.

Another thing: Spring.  This seems to be very popular and I'm wondering if I should consider it.  I don't know what part of our current product Spring would replace (if any).  It appears to work with EJB3 and Hibernate.  So if it works *with* them, then what does it provide that they don't?  Apparently it's not an alternative to either.  I have a lot more reading to do in this area.

I'm currently going through the EJB3.0 Trailblazer pages.  This is helpful and fairly easy to follow but it's not really telling me how to get from A to B (middlegen to hibernate, for example).  

I know that's a lot of rambling and I appreciate anyone who reads through it all.  Any pointers, big or small, on how to keep moving forward will be greatly appreciated.





View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4114321#4114321

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4114321




More information about the jboss-user mailing list