org.hibernate.metamodel.internal.EntityTypeImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hibernate-core Show documentation
Show all versions of hibernate-core Show documentation
The core O/RM functionality as provided by Hibernate
The newest version!
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or .
*/
package org.hibernate.metamodel.internal;
import java.io.Serializable;
import javax.persistence.metamodel.EntityType;
import org.hibernate.mapping.PersistentClass;
/**
* Defines the Hibernate implementation of the JPA {@link EntityType} contract.
*
* @author Steve Ebersole
* @author Emmanuel Bernard
*/
public class EntityTypeImpl extends AbstractIdentifiableType implements EntityType, Serializable {
private final String jpaEntityName;
@SuppressWarnings("unchecked")
public EntityTypeImpl(Class javaType, AbstractIdentifiableType superType, PersistentClass persistentClass) {
super(
javaType,
persistentClass.getEntityName(),
superType,
persistentClass.getDeclaredIdentifierMapper() != null || ( superType != null && superType.hasIdClass() ),
persistentClass.hasIdentifierProperty(),
persistentClass.isVersioned()
);
this.jpaEntityName = persistentClass.getJpaEntityName();
}
@Override
public String getName() {
return jpaEntityName;
}
@Override
public BindableType getBindableType() {
return BindableType.ENTITY_TYPE;
}
@Override
public Class getBindableJavaType() {
return getJavaType();
}
@Override
public PersistenceType getPersistenceType() {
return PersistenceType.ENTITY;
}
}