# Entity detached right after find?

**URL:** <https://discourse.hibernate.org/t/entity-detached-right-after-find/2946>\
**Category:** Hibernate ORM\
**Created:** [July 5, 2019, 8:05pm UTC](https://discourse.hibernate.org/t/entity-detached-right-after-find/2946 "2019-07-05T20:05:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![eezacque](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/eezacque/32/694_2.png) [@eezacque](https://discourse.hibernate.org/u/eezacque)\
**Post date:** [July 5, 2019, 8:05pm UTC](https://discourse.hibernate.org/t/entity-detached-right-after-find/2946/1 "2019-07-05T20:05:21Z")

</div>

Looks like my entity manager detaches entities right after a simple find.

```auto
	@PersistenceContext(unitName="wis-unit", type=PersistenceContextType.EXTENDED)
	private EntityManager entityManager;

       	@TransactionAttribute(TransactionAttributeType.REQUIRED)
        public void test(){

           Address adr=entityManager.find(Address.class, 2);
           System.out.println("id=2:"+adr + " "+entityManager.contains(adr));
         }

```

That is, the entity is flagged as ‘false’ by the above code.  
Any clue as to what goes wrong here is appreciated.

---

<div class="post-metadata">

**Author:** ![eezacque](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/eezacque/32/694_2.png) [@eezacque](https://discourse.hibernate.org/u/eezacque)\
**Post date:** [July 6, 2019, 12:05pm UTC](https://discourse.hibernate.org/t/entity-detached-right-after-find/2946/2 "2019-07-06T12:05:13Z")

</div>

Problem solved, the @Transactional annotation works for public methods only.
