[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - overriding of embedded field names

mars1412 do-not-reply at jboss.com
Fri Apr 4 06:13:21 EDT 2008


when I use the same embedded component several times in my entity (e.g. Addresses), I need to use @AttributeOverride for EACH field of the embedded component.

This is tedious when the entity is used several times and has a lot of fields.
And if you add a field to the embeddable component, you might forget to update all @AttributeOverrides.

Is there a simple method to define one single prefix for the fieldnames?

If not, should we raise a feature request for smth. like this:


  | 
  | @Entity
  | public class Address {
  | string country;
  | string state;
  | string street;
  | ...
  | }
  | 
  | @Entity
  | public class Male {
  | 
  | @Embedded(prefix="wifesAddress_")
  | Address wifesAddress;
  | 
  | @Embedded(prefix="girlfriendsAddress_")
  | Address girlfriendsAddress;
  | 
  | ..
  | 
  | }

resulting in this database table:


  | Table: Male
  | Columns:
  | wifesAddress_country;
  | wifesAddress_state;
  | wifesAddress_street;
  | girlfriendsAddress_country;
  | girlfriendsAddress_state;
  | girlfriendsAddress_street;
  | ...
  | 

What do you think?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4141603#4141603

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4141603



More information about the jboss-user mailing list