openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agurkas <>
Subject RE: very simple generics example, but how to make it work with openjpa?
Date Sun, 30 Jan 2011 19:00:54 GMT

>public Apple getFruit(){
>    return Apple.class.cast(super.getFruit());

one of the reasons to use generics is to avoid unsafe casting. What you
suggest defies it.
One of the points of moving Fruit and its getters setters was to have less
duplicating code in entity subclasses and also using generics in their
services and still have type safety. You suggest quite opposite.

And in the first place we were actually talking about Openjpa not being able
to persist those entities at all in this particular scenario as Openjpa does
not support generic types in MappedSuperclass and it cannot resolve
targetEntity when persisting entities correctly.

Your solution wont solve this issue.

Kind regards,


View this message in context:
Sent from the OpenJPA Users mailing list archive at

View raw message