db-jdo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "boegner-online@gmx.de" <boegner-onl...@gmx.de>
Subject Parameterized constructors with JDO
Date Fri, 20 Aug 2010 16:38:35 GMT

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 
- Is there a related feature at development or did you even think about it?
- Any other proposal?

Thanks in advance


View raw message