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 Vidas,

  You may want to look at our Dynamic JPA feature.  Here's a link to an example:

http://wiki.eclipse.org/EclipseLink/Examples/JPA/Dynamic

The feature is quite new and evolving quickly, so please post any issues you have to this forum.

-Tom

Vidas Timukas wrote:
Hi, Frank,

Thanks for advice, but:

2010/5/7 Frank Schwarz <fs5@xxxxxxx <mailto: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


------------------------------------------------------------------------

_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users


Back to the top