Hello,
I am new here. I looked at the archives but I did not find anything
related. Maybe a search function would be nice.
Sometimes there are classes which need some other objects to work well.
When I write those classes I like to write a constructor with those
dependencies as parameters. So there is no default constructor anymore.
I think this is nice, because everyone who uses my class can't do much
wrong now. The instances are in a consistent state (at least at
initialisation time).
Without a parameterless constructor the class is no bean anymore. I
can't use such classes with JDO, right? I see that it is much easier for
an persistence layer to deal with bean's parameterless constructor
instead of constructors with parameters. But I think it would be a
really nice feature of JDO to do so.
Alternatively I thought about writing beans and using them as attributes
of my classes. Another alternative would be to use beans at the
persistence layer and my POJOs at application layer. In that case there
has to be an layer which converts between POJOs and beans. Both
approaches seem to work at a first look, but they require almost double
the code like a POJO only or bean only solution. For every POJO there
has a bean and maybe a converter be written. This is a huge repetition.
My questions are:
- Is it right, that there is no way that JDO can deal with parameterized
constructors?
- Is there a related feature at development or did you even think about it?
- Any other proposal?
Thanks in advance
c0d3x