java - Using new JPA on conditions for one to many mappings -


jpa 2.1 has been released , new feature seems on conditions.

i found mentioned in some blogs , eclipselink documentation.

how can make use of this?

i have 2 entities linked each other @onetomany , @joincolumn. have filter out of second entities.

the blog sample shows:

select s.name, count(p)   suppliers s left join s.products p     on p.status = 'instock'  group s.name 

how can make use of mappings?

the on clause queries, not mappings.

if want add additional criteria mapping, not jpa supports in spec.

with eclipselink can using descriptorcustomizer , setting mapping's selectioncriteria.

see, http://wiki.eclipse.org/eclipselink/examples/jpa/mappingselectioncriteria


Comments