Rejected
Details
Details
Assignee
Unassigned
UnassignedReporter
Leonardo Quijano
Leonardo QuijanoParticipants
Emmanuel Bernard
Leonardo Quijano
Michael Newcomb
Affects versions
Priority
Created September 27, 2005 at 5:24 PM
Updated March 9, 2006 at 9:28 PM
Resolved October 6, 2005 at 3:53 PM
It's useful to allow a column prefix to be specified for @Embedded objects. Right now, if I need to set a prefix (to differentiate between same-type columns in an entity), I have to do this:
@Embedded
@AttributeOverrides( {
@AttributeOverride(name="zip", column = @Column(name="billingaddress_zip") ),
@AttributeOverride(name="state", column = @Column(name="billingaddress_state") )
} )
public Address getBillingAddress {
return this.billingAddress;
}
@Embedded
@AttributeOverrides( {
@AttributeOverride(name="zip", column = @Column(name="homeaddress_zip") ),
@AttributeOverride(name="state", column = @Column(name="homeaddress_state") )
} )
public Address getHomeAddress {
return this.homeAddress;
}
etc...
The main problem with this approach is that any column changes in the underlying Embedded component propagate to the objects that use them. With a prefix is far easier to separate the different embedded components, like this:
@Embedded(prefix="billingaddress")
public Address getBillingAddress {
return this.billingAddress;
}
@Embedded(prefix="homeaddress")
public Address getHomeAddress {
return this.homeAddress;
}