# Namespacing and nested data-fetchers with federation-jvm

**URL:** https://community.apollographql.com/t/namespacing-and-nested-data-fetchers-with-federation-jvm/6120
**Category:** Schema Design
**Tags:** server, federation
**Created:** [April 11, 2023, 12:10am UTC](https://community.apollographql.com/t/namespacing-and-nested-data-fetchers-with-federation-jvm/6120 "2023-04-11T00:10:44Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Dunc\_T](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/dunc_t/32/4177_2.png) [@Dunc\_T](https://community.apollographql.com/u/Dunc_T)
#### Post date: [April 11, 2023, 12:10am UTC](https://community.apollographql.com/t/namespacing-and-nested-data-fetchers-with-federation-jvm/6120/1 "2023-04-11T00:10:45Z")

</div>

Hi,

So we’re attempting to resolve name-spaced queries with `federation-jvm` and can’t figure out how to structure the code to do this. Below is a simplified version of the schema we are using.

```auto
type ProductQueries {
    byId(id: ID!): Product
    list: Product
}

type Query {
    product: ProductQueries
}

```

The resultant query looks something like this:

```auto
query GetProductById($id: String) {
    product {
        byId($id) {
            id,
            name
        }
    }
}

```

With Apollo federation in the javascript world we simply define a resolver which returns an object with it’s own nested resolvers as such:

```auto
const resolvers = {
  Query: {
    product: () => ({
      byId: (id, {dataSources}) => {
        // Get the product
      }
    })
  },
  Product: {
    ....
  }
};

```

I’ve been playing around with this using the java federation-jvm library and can’t figure out how to resolve the query, any guidance or examples on how to do this would be much appreciated.

---

<div class="post-metadata">

### Author: ![Justin\_Gonzalez](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/justin_gonzalez/32/5359_2.png) [@Justin\_Gonzalez](https://community.apollographql.com/u/Justin_Gonzalez)
#### Post date: [February 6, 2025, 8:49pm UTC](https://community.apollographql.com/t/namespacing-and-nested-data-fetchers-with-federation-jvm/6120/2 "2025-02-06T20:49:00Z")

</div>


