p


Written on January 12, 2005 – 12:00 am | by mpayne

post todayds

Some complaints about hibernate 2


Written on November 30, 2004 – 12:00 am | by mpayne

After learning hibernate, dealing with and solving all the lazy loading issues and everything involved with learning the product where does the on going pain still occur

Let me first start off, by saying I generally like hibernate and will continue using it.

However, there are a couple sore spots that really erk me and cause much pain.

No support for batch operations coupled with that lack of a “good” tap in point for delagating interceptors to a given pojo or mapping.

E.g. suppose you have and object that when deleted requires  clean up.  i.e. references that either need to be nulled out, deleted, or logged.   

Your options are:

  1. Implement the Lifecycle interface in your pojo.

see http://www.hibernate.org/hib_docs/reference/en/html/persistent-classes.html#persistent-classes-lifecycle.  Cons:  Your pojo is no longer a pojo, but an object that is bound to hibernate dependencies.  Wasn’t the point of hibernate is that your objects were Plain Old Java Objects.

2. Create an EntityInterceptor. see (http://www.hibernate.org/hib_docs/reference/en/html/manipulatingdata.html#manipulatingdata-interceptors)  This this might be helpful for auditing or a specific concern.  However, –> Cons: You can only have ONE of these.  What about other concerns? Trying to roll them up in one would be scary.  Seems kind of overkill, if certain concerns only apply to a sub-set of the pojo’s.

3. Completely Mention every relation in your mapping.  Cons:  Can be slow.  Also, you may know a better way of batch deleting things in certain cases.  Your POJOs may become polluted with extra collections of stuff with no buisness meaning other that making sure your persistance solution cleans up after itself.  In addition, it tough to deal with in systems that contain a relating set of data that isn’t mapped yet or should’t be mapped because behaves by a different set of rules.  i.e. references to dead object in task or audit logs.  These refences need to be looked up “IF” they exist, but if mapped the dead references would cause hibernate fits.

4.  Use a DAO layer for all crud operations.  This seems to be the most approriate way to go.  Its works!  However, you just must be sure developers never just call session.delete(object) and skip the layer.  Cons: Object poliferation/explosion. Design concerns… Should every pojo have a corresponding DAO?  Could seem like overkill.  What ever happed to the promise of saving an object and hibernate would take care of saving the dirty associations.   

My suggestion:  Remove Lifecycle interface for class and allow for a mapping of a class to mention an external class that implements the lifecycle interface.  

I haven’t seen the docs in hibernate 3(have they been written yet).  I am hoping that it will be more AOPish. Allow for multiple/layering for entity Interceptors and delegated them to only a subset of the classes.

Stop polluting code with log.debug and use a debugger(Dammit!)


Written on October 21, 2004 – 12:00 am | by mpayne

loI have felt this way for a while, but another javablogs post motivated me to re-iterate this feeling.

I am tired of developers polluting source code with debug.log statements in place of just using a debugger. I am not saying, don’t use logging. But logging shouldn’t be used in place of a debugger.

I have seen several developers that, debug a web or web service app by constantly placing debug.log statements everywhere then, generating a new .war file then re-deploying(repeat-cycle). While I believe this to be a really slow way of working, don’t pollute our shared source code with log statements that only serve for your "debugging" and understanding of a program and not for adding value to debugging real problems that occur in production deployments.

Logging has it place. But, a debugger can be more useful when you are fumbling over the mechanics of the code.

GotoFile: very nice, small eclipse plugin


Written on October 5, 2004 – 12:00 am | by mpayne

Sometimes the best plugins are simple. This one is awesome of projects of any size. Just hit Ctrl-Alt-n and start typing your wide card.

Very helpful for navigation

see http://www.muermann.org/gotofile/

Second hand smoke from windows


Written on October 5, 2004 – 12:00 am | by mpayne

After moving into my new house, I setup my dsl connection. I am suprised that apon connecting my dsl modem to the interenet, my activity light is constantly active. I find it odd that my brand new account is getting this much external activity.

I am willing to bet that much of this activity is not from hackers directly, but from comprimised windows machines that are infected with some type of worm or spyware.

How are you handling exceptions in web services?


Written on August 8, 2004 – 12:00 am | by mpayne

Its not a big deal for java to java clients.

However, .NET or a perl client is going to have no idea what a java.lang.BlahException is.

Previous buisness logic just threw an exception with a (jdbc-duplicate key error), is this still okay to do.

The powers that be are insisting that all exceptions are generally recoverable. So someone programming against our ws could know, program around that various error codes they recieve (i.e. duplicate means it might already exist vs. just invalid values on their side).

We have a developer wrapping exceptions in a custom coded "Axis fault" and I think it smells funny to have the server side business logic refer to the web service implementation.

We could use custom coded return value objects that include that status of that call. However doing this might also mean. Changing business logic that was once agnostic to the fact that it was a web service call, does not seem that elegant either.

Perhaps it best solved via some proxy of an aop layer?

Eclipse feels much snappier under tiger..for real


Written on July 12, 2004 – 12:00 am | by mpayne

I made jdk1.5.0 beta (snapshot) my jdk in which eclipse runs under. To my surpise, it feels much more performant than 1.4.2(I am only comparing running eclipse). Especially when many files are open. Its much harder to make the ide “stutter”.

This is a welcome change, I like when my ide is quicker.

Velomix with Webwork and Hibernate


Written on June 8, 2004 – 12:00 am | by mpayne

This example shows how Velomix can speed up the routine by templating out fragments of your application development.

Webwork/XWork for Struts developers


Written on June 2, 2004 – 12:00 am | by mpayne
I was asked to compare Webwork to Struts and to give a little presentation/guide on converting to Webwork. Here is what I have so far. Feel free to highlight anything I missed, grammer errors, or general questions.

Weapons of mass destruction found in my town


Written on May 21, 2004 – 12:00 am | by mpayne

According to this news link weapons a mass destruction were found in my town. They can’t find weapons of mass destruction in Iraq and yet they find them in Willow Grove/Upper moreland PA.

Anyway this sensationalistic reporting or the terrorist prosecution categories are getting rediculous. Since when is a pipe bomb a weapon of mass desctruction? If I get rear-ended by an SUV can I sue for extra since they were driving a "Vehicle of Mass Destruction"?