Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » No [EntityType] was found for the key class in the Metamodel(EclipseLink 2.7.4 using Criteria API)
No [EntityType] was found for the key class in the Metamodel [message #1808133] Tue, 18 June 2019 04:53
Hui Jessie is currently offline Hui JessieFriend
Messages: 2
Registered: June 2019
Junior Member
Hi all,

When I upgrade EclipseLink from 2.5.2 to 2.7.4, I met the exception when using Criteria API to select data.

12:09:17,383 ERROR [stderr] (default task-47) Caused by: java.lang.IllegalArgumentException: No [EntityType] was found for the key class [hk.judiciary.icms.model.dao.entity.HrnRsltCd] in the Metamodel - please verify that the [Entity] class was referenced in persistence.xml using a specific <class>hk.judiciary.icms.model.dao.entity.HrnRsltCd</class> property or a global <exclude-unlisted-classes>false</exclude-unlisted-classes> element.

12:09:17,404 ERROR [stderr] (default task-47) at org.eclipse.persistence.internal.jpa.metamodel.MetamodelImpl.entityEmbeddableManagedTypeNotFound(

12:09:17,404 ERROR [stderr] (default task-47) at org.eclipse.persistence.internal.jpa.metamodel.MetamodelImpl.entity(

12:09:17,404 ERROR [stderr] (default task-47) at org.eclipse.persistence.internal.jpa.querydef.CommonAbstractCriteriaImpl.internalFrom(

12:09:17,405 ERROR [stderr] (default task-47) at org.eclipse.persistence.internal.jpa.querydef.AbstractQueryImpl.from(

Here attach the Critieria API program:
    	CriteriaBuilder builder = getEntityManager().getEntityManagerFactory()
		CriteriaQuery<HrnRsltCd> criteria = builder.createQuery(HrnRsltCd.class);
		Root<HrnRsltCd> root = criteria.from(HrnRsltCd.class);
		criteria =;
		List<Predicate> andPredicates = new ArrayList<Predicate>();
		// Active Flag
		andPredicates.add(builder.equal(root.get(PARAM_ACTIVE_FLAG), "1"));

		if (!CommonUtil.isNullOrEmpty(andPredicates)) {
			criteria.where(andPredicates.toArray(new Predicate[0]));

		TypedQuery<HrnRsltCd> query = getEntityManager().createQuery(criteria);
		return this.getResultList(query);

And here attach the persistence.xml
<?xml version="1.0" encoding="UTF-8"?>

    <persistence-unit name="icmshrnmcPU" transaction-type="JTA">
			<property name="" value="java:jboss/persistence/icmshrnmcPU" />
			<property name=""
				value="" />
			<property name="" value="JBoss" />
			<property name="eclipselink.composite-unit" value="true" />
			<property name="eclipselink.session.customizer"
				value="hk.judiciary.fmk.ejb.dao.entity.DefaultEntityInterceptor" />
			<property name="eclipselink.deploy-on-startup" value="true"/>


The 2 jar file (icms-entity-lib- and icmshrnmc-ejb.jar) also have their persistence.xml, anyway, with different persistence-unit names.

I did not have such problem when using EclipseLink 2.5.2 . Please help!

Previous Topic:createQuery method hangs for a query with multiple clauses
Next Topic:When Oracle converts empty string to null, does EclipseLink cache reflect that?
Goto Forum:

Current Time: Wed Jul 24 18:48:22 GMT 2024

Powered by FUDForum. Page generated in 0.03279 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top