Tuesday, March 20, 2012

Re: Is multi-level fetch depth with RequestFactory possible?

What does your request look like? It should be something like
myRequestFactory.profileRequest.fetchProfile(id).with("settings.definition").
All of the relations returned via request factory must be explicitly
asked for.

Jesse

On Tue, Mar 20, 2012 at 3:22 PM, Rogelio Flores
<rogelio.flores@gmail.com> wrote:
> I have an issue that might be JPA/Hibernate-related, but it could also be
> related to RequestFactory, so bear with me pls:
>
> I have the following JPA @Entity-s:
>
> class Profile {
>    @OneToMany(cascade = CascadeType.ALL)
>    List<Setting> settings = new ArrayList<Setting>();
>    // other properties...
> }
>
> class Setting {
>    @ManyToOne
>    SettingDefinition definition;
>    // other properties...
> }
>
> class SettingDefinition {
>    // some properties - no relationships defined here
> }
>
> When a list of Profiles is displayed on a GWT UI (produced by Spring Roo,
> which uses RequestFactory), all their properties are displayed fine, except
> the individual Settings in the List have null SettingDefinitions even if
> they're not null in the db (I checked). I tried fetching eagerly and forcing
> it to not be null with:
>
> @ManyToOne(fetch=FetchType.EAGER, optional=false)
> SettingDefinition definition;
>
> and also increasing the hibernate.max_fetch_depth to more than three (AFAIK,
> 3 is the default), but I can't get the Settings to have their corresponding
> SettingDefinitions when they come from the server. Is there a setting or
> something that can be done to force these referenced entities so that they
> are fetched?
>
> (I posted this issue on the Roo forum but I've seen no response there:
> http://forum.springsource.org/showthread.php?124490-Fetching-eagerly-on-Lists-1-n If
> this can be solved by the RequestFactory framework, this should be the right
> place to ask).
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To post to this group, send email to google-web-toolkit@googlegroups.com.
> To unsubscribe from this group, send email to
> google-web-toolkit+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate