java.lang.IllegalArgumentException

If you like a tip written by other Samebug users, mark is as helpful! Marks help our algorithm provide you better solutions and also help other users.
tip

Properties of subclasses may have to be referenced in a different way. More on this here: https://goo.gl/FvnBXb

You have a different solution? A short tip here would help you and many other users who saw this issue last week.

  • Spring Data JPA and Generics
    via Stack Overflow by delewis
    ,
  • JPA 2.1 Eager Fetch Attribute
    via Stack Overflow by mkuff
    ,
  • {code} @Entity private static class Company implements Serializable { @Id @GeneratedValue public long id; @OneToMany public Set<Employee> employees; } @Entity @Inheritance( strategy = InheritanceType.TABLE_PER_CLASS ) private static class Employee { @Id @GeneratedValue public long id; @ManyToMany public Set<Manager> managers; } @Entity private static class Manager extends Employee { } {code} {code} Subgraph<Employee> subgraph1 = entityGraph.addSubgraph( "employees" ); subgraph1.addAttributeNodes( "managers" ); Subgraph<Employee> subgraph2 = subgraph1.addSubgraph( "managers" ); subgraph2.addAttributeNodes( "managers" ); {code} {code} java.lang.IllegalArgumentException: Unable to locate Attribute with the the given name [managers] on this ManagedType [org.hibernate.jpa.test.graphs.queryhint.QueryHintEntityGraphTest$Manager] at org.hibernate.jpa.internal.metamodel.AbstractManagedType.checkNotNull(AbstractManagedType.java:144) at org.hibernate.jpa.internal.metamodel.AbstractManagedType.getDeclaredAttribute(AbstractManagedType.java:137) at org.hibernate.jpa.graph.internal.SubgraphImpl.resolveAttribute(SubgraphImpl.java:124) at org.hibernate.jpa.graph.internal.AbstractGraphNode.buildAttributeNode(AbstractGraphNode.java:119) at org.hibernate.jpa.graph.internal.AbstractGraphNode.addAttribute(AbstractGraphNode.java:114) at org.hibernate.jpa.graph.internal.AbstractGraphNode.addAttributeNodes(AbstractGraphNode.java:109) at org.hibernate.jpa.graph.internal.SubgraphImpl.addAttributeNodes(SubgraphImpl.java:62) at org.hibernate.jpa.test.graphs.queryhint.QueryHintEntityGraphTest.testQueryHintEntityGraph(QueryHintEntityGraphTest.java:81) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at org.hibernate.testing.junit4.ExtendedFrameworkMethod.invokeExplosively(ExtendedFrameworkMethod.java:63) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) at org.junit.internal.runners.statements.FailOnTimeout$StatementThread.run(FailOnTimeout.java:74) {code}
    via by Brett Meyer,
    • java.lang.IllegalArgumentException: Unable to locate Attribute with the the given name [encounter] on this ManagedType [com.iimassociates.distiller.domain.EncounterPDFExport] at org.hibernate.jpa.internal.metamodel.AbstractManagedType.checkNotNull(AbstractManagedType.java:144) at org.hibernate.jpa.internal.metamodel.AbstractManagedType.getAttribute(AbstractManagedType.java:130) at org.springframework.data.jpa.repository.query.QueryUtils.toExpressionRecursively(QueryUtils.java:468) at org.springframework.data.jpa.repository.query.JpaQueryCreator$PredicateBuilder.getTypedPath(JpaQueryCreator.java:300) at org.springframework.data.jpa.repository.query.JpaQueryCreator$PredicateBuilder.build(JpaQueryCreator.java:243) at org.springframework.data.jpa.repository.query.JpaQueryCreator.toPredicate(JpaQueryCreator.java:148) at org.springframework.data.jpa.repository.query.JpaQueryCreator.create(JpaQueryCreator.java:88) at org.springframework.data.jpa.repository.query.JpaQueryCreator.create(JpaQueryCreator.java:46) at org.springframework.data.repository.query.parser.AbstractQueryCreator.createCriteria(AbstractQueryCreator.java:109) at org.springframework.data.repository.query.parser.AbstractQueryCreator.createQuery(AbstractQueryCreator.java:88) at org.springframework.data.repository.query.parser.AbstractQueryCreator.createQuery(AbstractQueryCreator.java:73) at org.springframework.data.jpa.repository.query.PartTreeJpaQuery$QueryPreparer.<init>(PartTreeJpaQuery.java:116) at org.springframework.data.jpa.repository.query.PartTreeJpaQuery$CountQueryPreparer.<init>(PartTreeJpaQuery.java:237) at org.springframework.data.jpa.repository.query.PartTreeJpaQuery.<init>(PartTreeJpaQuery.java:65) at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$CreateQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:100)

    Users with the same issue

    Unknown visitor1 times, last one,
    slash
    2 times, last one,
    Unknown visitor1 times, last one,
    Axelo
    1 times, last one,
    rafael
    1 times, last one,
    8 more bugmates