Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Conditional LEFT JOIN in JPQL

Hi, Frank,

Thanks for advice, but:

2010/5/7 Frank Schwarz <fs5@xxxxxxx>

The additional fields can also be mapped by a java.util.Map-structure, i.e.

public class Country {
...
 @ElementCollection
 @CollectionTable(name="ExtCharFields",
joinColumns=@JoinColumn(name="country_id"))
 @MapKeyColumn(name="fieldName")
 @Column(name="fieldValue")
 private Map<String, String> extChatFields;
...
}

Yep, that's true, and my first version was in this direction, but, in my real application:

1) Tables extCharFields, extIntFields, extDateFields... can hold additional data also from other tables.

2) There is a big performance issue, because with collections, additional records are retrieved in separate calls to DB per every parent row, and in my solution I can get all required data with single SQL.
 
 With this mapping, you would even have transparent "write access" to
ExtCharFields.

I also did this in my component :-)


--
Sincerely,
Vidas

Back to the top