# I defined two entity associate with Any annotation. now I want to find one entity with other entity by Jpa respository. but it error

**URL:** <https://discourse.hibernate.org/t/i-defined-two-entity-associate-with-any-annotation-now-i-want-to-find-one-entity-with-other-entity-by-jpa-respository-but-it-error/5845>\
**Category:** Hibernate ORM\
**Created:** [November 18, 2021, 1:41pm UTC](https://discourse.hibernate.org/t/i-defined-two-entity-associate-with-any-annotation-now-i-want-to-find-one-entity-with-other-entity-by-jpa-respository-but-it-error/5845 "2021-11-18T13:41:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![yu\_wang](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/yu_wang/32/1703_2.png) [@yu\_wang](https://discourse.hibernate.org/u/yu_wang)\
**Post date:** [November 18, 2021, 1:41pm UTC](https://discourse.hibernate.org/t/i-defined-two-entity-associate-with-any-annotation-now-i-want-to-find-one-entity-with-other-entity-by-jpa-respository-but-it-error/5845/1 "2021-11-18T13:41:58Z")

</div>

I defined two entity associate with Any annotation. now I want to find one entity with other entity by Jpa respository.  
but it throw

```auto
java.lang.IllegalArgumentException: Unable to locate Attribute with the the given name [monitorObject] on this ManagedType [cn.sm.data.hanoispring.domain.ScIndicator]

```

more detail see,[Jpa find with hibernate Any field error.throw · Issue #2318 · spring-projects/spring-data-jpa · GitHub](https://github.com/spring-projects/spring-data-jpa/issues/2318)

I want to know if I define any association , how can i query with associated field

thanks

---

<div class="post-metadata">

**Author:** ![beikov](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/beikov/32/258_2.png) [@beikov](https://discourse.hibernate.org/u/beikov)\
**Post date:** [November 23, 2021, 8:23am UTC](https://discourse.hibernate.org/t/i-defined-two-entity-associate-with-any-annotation-now-i-want-to-find-one-entity-with-other-entity-by-jpa-respository-but-it-error/5845/2 "2021-11-23T08:23:38Z")

</div>

I don’t know what Spring Data does there, but the Spring Data team commented on the issue you posted that they don’t want to support this, so I don’t know what to tell you. If you can show that there is a problem with Hibernate by writing a pure Hibernate test case([hibernate-test-case-templates/JPAUnitTestCase.java at main · hibernate/hibernate-test-case-templates · GitHub](https://github.com/hibernate/hibernate-test-case-templates/blob/master/orm/hibernate-orm-5/src/test/java/org/hibernate/bugs/JPAUnitTestCase.java)) that reproduces the issue, we can take a look.
