I am "annotating" an entity Menu
using hibernate / jpa, and Menu
contains a ShareActivity
I am "annotating" an entity Menu
using hibernate / jpa, and Menu
contains a ShareActivity
Use the @AssociationOverride
annotation. Example:
Class Menu
:
@Entity
public class Menu {
@Embedded
@AssociationOverride(name="status",joinTable=@JoinTable(name="menu_share_activity"))
private ShareActivity enable;
//outros métodos e atributos
}
Class ShareActivity
:
@Embeddable
public class ShareActivity {
@ElementCollection
@MapKeyColumn(name="actor")
@MapKeyEnumerated(EnumType.STRING)
@Column(name="value")
private Map<Actor, Boolean> status;
public ShareActivity() {
this.status = new HashMap<Actor, Boolean>();
this.status.put(Actor.owner, true);
this.status.put(Actor.company, false);
this.status.put(Actor.custumers, false);
this.status.put(Actor.employee, false);
this.status.put(Actor.friend, false);
}
}