generated model misses <T>

Description

I'd like to generate the meta model for the following entity, that is a generic abstract class:

The model is generated successfully, but the resulting class is not generic. The "<T>" is missing:

Environment

None

Activity

Show:
Tomas Vala
April 25, 2014, 11:22 AM
Edited

Hello,

missing support for generics is clearly apparent in conjuction with use of javax.persistence.MappedSuperclass annotation.

Let's have a generic superclass:

HelloWorldSuperclass.java

Then define type specific subclass:

HelloWorldInteger.java

And another one for variety sake:

HelloWorldString.java

Resulting metamodel classes do not have correct types where expected. All parametrized types are translated to mere Object in superclass and subclasses.

generated metamodel classes

This is rather inconvenient and impossible to use reasonably further on in CriteriaBuilder.

Tomas

Craig Andrews
August 10, 2015, 2:20 PM

I think the expected generated metamodel classes are:

Hardy Ferentschik
August 21, 2015, 2:21 PM

Resulting metamodel classes do not have correct types where expected. All parametrized types are translated to mere Object in superclass and subclasses.

Do we agree that in the super type Object needs to be used? We cannot have multiple versions of the class really. Which leaves the sub-class. I guess the solution mentioned above is the best I can think of, but then again, the spec says:

For every persistent non-collection-valued attribute y declared by class X, where the type of y
is Y, the metamodel class must contain a declaration as follows:

And the sub-types do not declare the fields/properties in question.

Kuzmich
January 28, 2019, 3:13 PM

Are there any movements on this issue?

Guillermo López
September 20, 2020, 3:04 PM

@Craig Andrews I believe that the static metamodel should be more specific for subclasses:

And with respect the superclass, it might be desirable to be more specific too in order to avoid type-related warnings (this, however, could complicate some assignments):

Assignee

Unassigned

Reporter

MichaelM

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Priority

Critical
Configure