Let's consider this use case: {code :java } @Embeddable class Component { private String component;
public Component() { }
private Component(String component) { this.component = component; }
public String getComponent() { return component; }
public void setComponent(String component) { this.component = component; } }
@Entity(name = "CardGame") class CardGame {
private String id;
private Component firstPlayerToken;
public CardGame() { }
private CardGame(String id, String name) { this.id = id; this.name = name; this.firstPlayerToken = createEmbeddedValue( name ); }
@Id public String getId() { return id; }
public void setId(String id) { this.id = id; }
public String getName() { return name; }
public void setName(String name) { this.name = name; this.firstPlayerToken = createEmbeddedValue( name ); }
@Embedded public Component getFirstPlayerToken() { return firstPlayerToken; }
public void setFirstPlayerToken(Component firstPlayerToken) { this.firstPlayerToken = firstPlayerToken; }
private Component createEmbeddedValue(String name) { return new Component( name + " first player token" ); } } } {code}
When we enable the inline dirty checking enhancement and create the entity, the dynamic field $$_hibernate_compositeOwners is null . names does not contain If we put the embedded annoation on the field , it is initialized with the value "firstPlayerToken".
I don't think the behaviour should be different in these cases but I might be wrong. |
|