Hi all!
What I'm trying to do is some kind of "view" of a objects, mapped as a component. Let's say I have the following class:
Code:
@Entity
public class A {
private Integer x;
private Integer y;
private Integer z;
@Embedded
private ComponentA a;
@Embedded
private ComponentB b;
// etc...
}
@Embeddable
public class ComponentA {
Integer x;
Integer y;
// etc...
}
@Embeddable
public class ComponentB {
Integer y;
Integer z;
// etc...
}
What I want to do is that each component use several columns from class A, but at the same time, class A has them also mapped separately. Not only that but the components can share some columns also.
¿Is it possible in any way? Mapped as showed doesn't work as the shared columns names must be overriden.
I know that the way should be createn table views in the database but I wondered if there was any other way using mappings.
Thank you all.