We're updating the issue view to help you get more done. 

Use a SuperClass as target entity in a @OneToMany relationship

Description

HI there,
supposing to have an abstract SuperClass, with a single table inheritance, like this:

1 2 3 4 5 6 7 8 9 @Entity @Inheritance(strategy = InheritanceType.SINGLE_TABLE) @DiscriminatorFormula("...") @Table(name = "groups") public abstract class AbstractGroup<H extends AbstractGroup<H>> implements Serializable { @ManyToOne @JoinColumn(name = "parent_groupid", referencedColumnName = "groupid") private H parent; }

You can receive this error message:

1 Property entity.AbstractGroup.parent has an unbound type and no explicit target entity. Resolve this Generic usage issue or set an explicit target attribute (eg @OneToMany(target=) or use an explicit @Type.

I think that you could accept target type as an instance of AbstractGroup, because you're using inheritance on a single table, so you could know which is the right class.

What do you think about this?

Environment

None

Status

Assignee

Unassigned

Reporter

Alex Tomasello

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Priority

Major