cancel
Showing results for 
Search instead for 
Did you mean: 

Inheritance in Web Dynpro Model

Former Member
0 Kudos

Hello

This is the current situation:

I have 3 JPA entity classes much like these (including constructors, getters, setters, ...).

@Entity
public abstract class OuComponent {
 @ManyToOne
 private Ou ou;
}
@Entity
public class Ou extends OuComponent {
 @OneToMany
 private Collection<OuComponent> ouComponentCollection;
}
@Entity
public class Person extends Component {}

In the database, OuComponent has a discriminator column.

This structure appears to work in a normal web module and an EJB Module.

In Web Dynpro, using a model, I can create a new Person and attach an existing Ou to it (through the inherited property ou from OuComponent).

However, when I try to display the information, I recieve the following error:

java.lang.IllegalArgumentException: Cannot perform write operation 'setRelatedModelObjects' on target role: Class 'Person' is not compatible to class 'OuComponent' of target role 'ouComponentCollection' in model class 'Ou'

It appears that Web Dynpro does not realise that Person is actually a subclass from OuComponent. I think it simply checks the discriminatorcolumn for the word 'OuComponent' and throws this exception because it finds a related entity of the type Person instead of OuComponent (even though, as stated, Person IS-A OuComponent. Web Dynpro just seems to ignore it).

How could I bypass this?

Thanks for your feedback

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Vincent.

Have you resolve this problem? If yes, could you post the solution?

Regards

Marcos Brandã