use of org.hibernate.cfg.annotations.NamedEntityGraphDefinition in project hibernate-orm by hibernate.
the class InFlightMetadataCollectorImpl method addNamedEntityGraph.
@Override
public void addNamedEntityGraph(NamedEntityGraphDefinition definition) {
final String name = definition.getRegisteredName();
final NamedEntityGraphDefinition previous = namedEntityGraphMap.put(name, definition);
if (previous != null) {
throw new DuplicateMappingException(DuplicateMappingException.Type.NAMED_ENTITY_GRAPH, name);
}
}
use of org.hibernate.cfg.annotations.NamedEntityGraphDefinition in project hibernate-orm by hibernate.
the class Configuration method reset.
protected void reset() {
implicitNamingStrategy = ImplicitNamingStrategyJpaCompliantImpl.INSTANCE;
physicalNamingStrategy = PhysicalNamingStrategyStandardImpl.INSTANCE;
namedQueries = new HashMap<String, NamedQueryDefinition>();
namedSqlQueries = new HashMap<String, NamedSQLQueryDefinition>();
sqlResultSetMappings = new HashMap<String, ResultSetMappingDefinition>();
namedEntityGraphMap = new HashMap<String, NamedEntityGraphDefinition>();
namedProcedureCallMap = new HashMap<String, NamedProcedureCallDefinition>();
standardServiceRegistryBuilder = new StandardServiceRegistryBuilder(bootstrapServiceRegistry);
entityTuplizerFactory = new EntityTuplizerFactory();
interceptor = EmptyInterceptor.INSTANCE;
properties = new Properties();
properties.putAll(standardServiceRegistryBuilder.getSettings());
}
use of org.hibernate.cfg.annotations.NamedEntityGraphDefinition in project hibernate-orm by hibernate.
the class MetamodelImpl method applyNamedEntityGraphs.
@SuppressWarnings("unchecked")
private void applyNamedEntityGraphs(java.util.Collection<NamedEntityGraphDefinition> namedEntityGraphs) {
for (NamedEntityGraphDefinition definition : namedEntityGraphs) {
log.debugf("Applying named entity graph [name=%s, entity-name=%s, jpa-entity-name=%s", definition.getRegisteredName(), definition.getEntityName(), definition.getJpaEntityName());
final EntityType entityType = entity(definition.getEntityName());
if (entityType == null) {
throw new IllegalArgumentException("Attempted to register named entity graph [" + definition.getRegisteredName() + "] for unknown entity [" + definition.getEntityName() + "]");
}
final EntityGraphImpl entityGraph = new EntityGraphImpl(definition.getRegisteredName(), entityType, this.getSessionFactory());
final NamedEntityGraph namedEntityGraph = definition.getAnnotation();
if (namedEntityGraph.includeAllAttributes()) {
for (Object attributeObject : entityType.getAttributes()) {
entityGraph.addAttributeNodes((Attribute) attributeObject);
}
}
if (namedEntityGraph.attributeNodes() != null) {
applyNamedAttributeNodes(namedEntityGraph.attributeNodes(), namedEntityGraph, entityGraph);
}
entityGraphMap.put(definition.getRegisteredName(), entityGraph);
}
}
Aggregations