/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2009, 2013, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.jpa.internal.metamodel;
import java.io.Serializable;
import javax.persistence.metamodel.EntityType;
import org.hibernate.mapping.PersistentClass;
Defines the Hibernate implementation of the JPA EntityType
contract. Author: Steve Ebersole, Emmanuel Bernard
/**
* Defines the Hibernate implementation of the JPA {@link EntityType} contract.
*
* @author Steve Ebersole
* @author Emmanuel Bernard
*/
public class EntityTypeImpl<X> extends AbstractIdentifiableType<X> implements EntityType<X>, Serializable {
private final String jpaEntityName;
@SuppressWarnings("unchecked")
public EntityTypeImpl(Class javaType, AbstractIdentifiableType<? super X> 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<X> getBindableJavaType() {
return getJavaType();
}
@Override
public PersistenceType getPersistenceType() {
return PersistenceType.ENTITY;
}
}