# UnknownEntityTypeException: Unable to locate persister after Migration to 5.2

**URL:** <https://discourse.hibernate.org/t/unknownentitytypeexception-unable-to-locate-persister-after-migration-to-5-2/1008>\
**Category:** Hibernate ORM\
**Created:** [July 2, 2018, 4:34pm UTC](https://discourse.hibernate.org/t/unknownentitytypeexception-unable-to-locate-persister-after-migration-to-5-2/1008 "2018-07-02T16:34:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![azardi](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/azardi/32/24_2.png) [@azardi](https://discourse.hibernate.org/u/azardi)\
**Post date:** [July 2, 2018, 4:34pm UTC](https://discourse.hibernate.org/t/unknownentitytypeexception-unable-to-locate-persister-after-migration-to-5-2/1008/1 "2018-07-02T16:34:17Z")

</div>

After Migration from 4.1.19 to 5.2.17 we got

> org.hibernate.UnknownEntityTypeException: Unable to locate persister:

when calling

> Session.get(Class clazz, Serializable id)

We don’t use Hibernate/JPA-Annotations. We still use legacy HBM mapping-files.

Here’s what the Initialization-Method for the SessionFactory looks like:

```auto
private synchronized SessionFactory getSessionFactory() {
	private SessionFactory sessionFactory;
	
	try {
             // Create configuration 
	     Configuration configuration = new Configuration();

	     // add custom-Hibernate-Interceptor
  	     configuration.setInterceptor(new myInterceptor());
				
	     // Build a Service-Registry
	     aServiceRegistry = new StandardServiceRegistryBuilder(bootstrapRegistry)
				                                       .applySettings(configuration.getProperties())
				                                       .configure()
				                                       .build();

             // Build the MetadataSources
	     MetadataSources aSources = new MetadataSources(aServiceRegistry);
				
   	     // Build the Metadata
	     Metadata metadata = aSources.getMetadataBuilder().build();				
				
	     // Build the SessionFactory
	     sessionFactory = metadata.getSessionFactoryBuilder().build();
       } 
       catch (Throwable ex) {
		....
       }
	
       return sessionFactory;
}

```

---

<div class="post-metadata">

**Author:** ![vlad](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/vlad/32/658_2.png) [@vlad](https://discourse.hibernate.org/u/vlad)\
**Post date:** [July 2, 2018, 5:01pm UTC](https://discourse.hibernate.org/t/unknownentitytypeexception-unable-to-locate-persister-after-migration-to-5-2/1008/2 "2018-07-02T17:01:53Z")

</div>

Try to replicate it [like this](http://in.relation.to/2018/06/04/best-way-write-hibernate-orm-issue-test-case/) so we can investigate it further.
