Skip to main content



      Home
Home » Eclipse Projects » EclipseLink » Is it possible to return a Collection inside a multiselect (CriteriaBuilder)
Is it possible to return a Collection inside a multiselect (CriteriaBuilder) [message #525473] Tue, 06 April 2010 12:43 Go to next message
Eclipse UserFriend
Hi,

How can I return certain properties of an entity. Is to say, I've an entity with:

property1
property2
property3 --> this is a set (oneToMany)
property4
...
property40

And I need only to return property1,property2 and property 3

Is it possible? How can I do this? Can I do this with sql o jql?

Lot of thanks,

Marcial
Re: Is it possible to return a Collection inside a multiselect (CriteriaBuilder) [message #527035 is a reply to message #525473] Tue, 13 April 2010 15:14 Go to previous message
Eclipse UserFriend
I think you can just select the 1-m the same as any other attribute.

In JPQL you could do,

Select e.property1, e.property2, e,property3 from Entity e

The equivalent should work with the Criteria API, what code do you have so far?

This will return you a List<Object[]> where the Object[] has property1, property2, and each of the property3 (one Object[]/row for each property3 instance).

In EclipseLink you could also just do a normal query and use a fetch-group query hint to only select the desired attributes for the object.
Previous Topic:How can I add extra join conditions with left joins
Next Topic:Class loading problem on new() in JPQL
Goto Forum:
  


Current Time: Tue Jul 22 14:29:21 EDT 2025

Powered by FUDForum. Page generated in 0.05229 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top