Reputation: 81
java.lang.IllegalArgumentException: No [EntityType] was found for the key class [] in the Metamodel - please verify that the [Entity] class was referenced in persistence.xml using a specific <class> </class> property or a global <exclude-unlisted-classes>false</exclude-unlisted-classes> element.
at org.eclipse.persistence.internal.jpa.metamodel.MetamodelImpl.entityEmbeddableManagedTypeNotFound(MetamodelImpl.java:173)
Entity class:
@Entity
@Table(name="temp_param")
public class ParamConfiguration implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Column(name = "param_group")
private String paramGroup;
public String getParamGroup() {
return paramGroup;
}
public void setParamGroup(String paramGroup) {
this.paramGroup = paramGroup;
}
DAO code:
CriteriaQuery<ParamConfiguration> cq = entityManager
.getCriteriaBuilder()
.createQuery(ParamConfiguration.class);
final Root<ParamConfiguration> ac = cq.from(ParamConfiguration.class);
cq.select(ac);
TypedQuery<ParamConfiguration> tq=entityManager.createQuery(cq);
List<ParamConfiguration> AClist=tq.getResultList();
persistance xml:
<persistence-unit name="serCoupons_Cdm" transaction-type="RESOURCE_LOCAL">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<non-jta-data-source>java:/comp/env/jdbc/CDM</non-jta-data-source>
<class>net.odcorp.sas.mrm.beans.AffinityConfiguration</class>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
Can anyone help me on this.... Is the @entity class must have all the columns in the DB table.
FYI im using Teradata as DB, Spring, JPA, JSF.
Upvotes: 3
Views: 5339
Reputation: 782
I had the same issue, but in my case I was missing the @Table annotation. Also in my code don't use @Column annotation, I use @GeneratedValue(strategy= GenerationType.IDENTITY) right below @Id. It works for me without using
<exclude-unlisted-classes>true</exclude-unlisted-classes>
I can provide my source code since I've just been using to learn about JPA.
Upvotes: 0
Reputation: 17365
Try this in your persistence.xml file,
<persistence-unit name="serCoupons_Cdm" transaction-type="RESOURCE_LOCAL">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<non-jta-data-source>jdbc/CDM</non-jta-data-source>
<exclude-unlisted-classes>false<exclude-unlisted-classes/>
exclude-unlisted-classes
has true as it's default value. or if its set to true, then you need to specify the tag manually to list the entity class,
<class>com.package.Class</class>
Upvotes: 1
Reputation: 1003
Your ParamConfiguration
entity is not listed in the persistence.xml file and you set the option exclude-unlisted-classes
to true
add this to your persistence.xml file :
<class>net.odcorp.sas.mrm.beans.ParamConfiguration</class>
be sure that the package is ok.
Upvotes: 1