Hi!

I have a JPA2.0 question.

I did find some discussion (better: complaints) about embedding members of the 
same class multiple times, but could not find the information about how this 
will be solved in the JSR-317 draft. So maybe anyone can point me to some 
information about this.

I've used kodo for a long time, and I know that that the code already exists 
and did work with JDO.

Here is my problem:

Imagine having a

@Embeddable
public class Address {
  private String zip;
  private String city;
  private String street;
  ...
}

and you like to use this Address multiple times in another entity:

@Entity
public class Customer {
  private String name
  @Embedded private Address deliveryAddress;
  @Embedded private Address invoiceAddress;
}

This does not work out as expected, since the created SQL does only generate 
ONE set of the fields (and _silently_ skipping the 2nd Address!).
This can be worked around by using @AttributeOverrides, but you will get into 
troubles if the Address also contains an embedded field (eg '@Embeddable public 
class Contact' containing tel, fax, email) since you cannot control these names 
via the attribute overrides anymore.

So, I'd like to know if it is likely that there is anything like 
@Embedded(prefix="INVOICE")
@Embedded(prefix="DELIVER")
with an automated default mechanism like kodo-JDO had?


(and please don't argue that addresses should stored in a 1:n table anyway - 
this is only an example ;)

txs and LieGrue,
strub




Reply via email to