Archive for July 2006

from UML to DDL

July 28, 2006

Traditionally when I am designing a project I will usually start with developing a relational data model. If I’m using Hibernate, I will proceed to generate or write my Hibernate mapping files (.hbm) and from there I can generate the plain Java objects (POJO’s). I decided to try the approach the other way around. Using MyEclipse’s UML modeling, I created my domain model. Besides modeling the data in UML up front, it let’s me ignore the details of the physicial data implementation at a stage when I think those details are distracting. Also when starting in UML it seems much easier for me to discover the service-type classes and collaborators with the domain model.

Now for getting to the DDL.

  1. The POJO’s have to be annotated by hand. This could maybe be automated in the generation of the Java code from the UML but the MyEclipse interface doesn’t allow for this. It would be a nice touch though. Understanding how to represent relationships in XDoclet for Hibernate is critical.
  2. Run XDoclet to generate the .hbm files. Again I used the stock plugin with MyEclipse to run XDoclet.
  3. The last step really is to call upon Hibernate to generate the DDL at startup time. Here’s were I think a rigorous set of JUnit tests works well for verifying that the data model is correct and matches syntactically what the business layer expects.

One final aspect I’m yet to work out is how to introduce static data into the build process. For lack of anything mor elegant, I’m using a custom Ant task to run a MySQL script for the data import when my application gets deployed.

rethinking my IDE choices

July 26, 2006

I’m sort of between projects and it is giving me some time to evaluate my options for IDE choices.

I just worked with Maven briefly on a project and want to continue using it to manage the environment on my future projects. I’m finding though that the tools aren’t necessarily keeping up. I’ve been using MyEclipse for a few years now and it does a good job of making my life easier in dealing with hot deployment to whatever app server I happen to be using. I also don’t think I could live without its Spring integration.

Sadly MyEclipse doesn’t currently support Maven, but I just visited their site and the MyEclipse team claims to be adding support soon.

I also tried a bit with the Eclipse Web Tools and found that the M2Eclipse plugin did not play well with version 1.5 of the WTP. This is too bad since I’ve worked with M2Eclipse and found it to be an extremely handy plugin.

I am forced to just wait for the time being. I’d like to give the WTP a test drive on a small project and may do so without using Maven to manage the project.

JavaOne Day 3

July 17, 2006

JavaOne is certainly over by now but I was recently reading through some notes I took during day 3 and thought I would write something.

I’ve completed a few sites that utilize Hibernate and Spring together for the purpose od databse access. For me it has been a mechanism that works well. If I were required to start a new JEE project today, it would again be the two technologies I would reach for if the site involved database access. I’ve done my time with classic EJB’s so using the DAO pattern with Spring was such a welcome relief.

While sitting through the EJB 3 presentations I had to wonder whether developers would really go back to EJB’s, especially those who had lived through it once. I also wondered what some of the original EJB presentations looked like. Did it take 340598 slides to show all the steps required to implement an entity bean and then wire up CRUD opperations through a session bean and then worry about how to test it and obtain a reference to the JNDI context…argh

Did the original slides show all of that or do they likely mindlessly simple like the ones shown at the 2006 JavaOne? I wonder. I have to admit though that it sure looks easy to use EJB 3, but so far I’m not tempted to go back since Spring/Hibernate is working for me. It seems right to add generics to my DAO implemenations wth Spring. Funny how I was doing a very similar thing about 9 years ago in C++ with templates around almost plain C++ objects and persisting them with ODBC.

more Mac thoughts

July 14, 2006

I recently picked up on Cedric’s discussion regarding switching from Windows to the Mac. As I’ve mentioned in previous blogs the main factor for me has been that the Mac OS offers vastly superior features for accessibility compared to Windows. This is still working well for me.

I also seem to have gotten over figuring out how to organize my development environment.

I’m still plagued by trying to learn keyboard shortcuts on the Mac though. I wish that the keystrokes multi-selecting files in the Finder mapped out the same as they do in Windows. I cringe when I’m faced with this task and have to reach for my mouse to get the job done.

Another shortcut that I haven’t figured out is that home and end don’t seem to work in an edit fied on the Mac. Why can’t I highlight the entire field by pressing option-home or something similar?

Finally the keboard shortcut I’m lacking most is ability to press Alt+Home in Firefox and have it bring me to my default homepage which is Google and the focus is set to the search field. I’m also trying out Camino lately.

I’m late to the show in becoming a del.icio.us user. Like most people I collect a lot of links and get tired of constantly organizing and cleaning out my favorites and also synchronizing them across all the computers that I use. Now its as simple as adding open button titled “post to del.icio.us” to each browser I use.

del.icio.us/aharvey