

Sometimes I hate Java - Thagor
http://malexandre.fr/posts/2012/Nov/21/sometimes-i-hate-java/

======
lmm
There are plenty of reasons to hate Java, but these aren't them.

Why are you wrapping and unwrapping your objects three times over? Just use
hibernate properly and it can replace all those generic DAOs.

Yes, generics aren't available via reflection for backwards compatibility
reasons, and this is unfortunate. But the getModelClass() workaround is pretty
simple, and you only need it at all because you've overengineered everything.

Yes, traditional java.util.Date is terrible, we know. It can't be replaced
because of, again, backwards compatibility. If you're doing serious work in
Java you use JodaTime and your life is good again.

~~~
Thagor
Hibernate can manage the client/server communication ? I thought it was just
to manage the server/database communication, and we used OpenJPA for that, so
it's kind of the same. My DAOs (yes the name isn't exactly the right one, but
I tried to simplify) are for the client/server communication, and in my case
for the GWT's RPC service implementation. And instead of having a lot of
service (on for each screen for example), or a lot of method in one big
service, I tried to have only one service. And for the Date, JodaTime is
awesome, but again, not compatible for the GWT's client-side. But yes, there
is other solutions than the built-in Date.

~~~
lmm
Hibernate won't do client/server communication (or at least it's not its main
focus); given what you've now said, the point is that you don't need more than
one "DAO". After all, the implementation code is the same in all cases.

