introproventures / graphql-jpa-query

Generate GraphQL Query Api for your JPA Entity Models
https://github.com/introproventures/graphql-jpa-query
Apache License 2.0
195 stars 55 forks source link

Fragment queries broken: 'could not initialize proxy - no Session' #241

Open molexx opened 4 years ago

molexx commented 4 years ago

Fragments worked fine a little while ago in 0.3.x but in 0.4 seem to have a broken transaction scope.

On master 510c5bf , this query works fine:

query {
  Humans {
    pages
    total
    select {
      id
      name
      friends {
        name
        id
      }
    }
  }
}

but the same query using a Fragment no longer does:

fragment HumanFragment on Human {
  id
  name
  friends {
    name
    id
  }
}

query {
  mydata:Humans {
    pages
    total
    select {
      ...HumanFragment
    }
  }
}
{
  "timestamp": "2020-02-03T11:47:49.915+0000",
  "status": 500,
  "error": "Internal Server Error",
  "message": "failed to lazily initialize a collection of role: com.introproventures.graphql.jpa.query.schema.model.starwars.Character.friends, could not initialize proxy - no Session",
  "path": "/graphql"
}
igdianov commented 4 years ago

@molexx Fragment queries are not supported, yet...

molexx commented 4 years ago

They worked ok up to 09dd88c but were broken in 3db0e51.