private EntityType<?> getTreatType(EntityMetamodel metamodel, Class<?> baseType, Class<?> subtype) { if (baseType == subtype) { return null; } return metamodel.entity(subtype); }
protected final <T> EntityType<T> getTreatType(Class<T> type) { return criteriaBuilder.getEntityMetamodel().entity(type); }
protected final <T> EntityType<T> getTreatType(Class<T> type) { return criteriaBuilder.getEntityMetamodel().entity(type); }
public <X> BlazeRoot<X> from(Class<X> entityClass, String alias) { EntityType<X> entityType = criteriaBuilder.getEntityMetamodel().entity(entityClass); if (entityType == null) { throw new IllegalArgumentException(entityClass + " is not an entity"); } return from(entityType, alias); }
public BlazeRoot<T> from(Class<T> entityClass, String alias) { EntityType<T> entityType = criteriaBuilder.getEntityMetamodel() .entity(entityClass); if (entityType == null) { throw new IllegalArgumentException(entityClass + " is not an entity"); } return from(entityType, alias); }
public <X> BlazeRoot<X> from(Class<X> entityClass, String alias) { EntityType<X> entityType = criteriaBuilder.getEntityMetamodel().entity(entityClass); if (entityType == null) { throw new IllegalArgumentException(entityClass + " is not an entity"); } return from(entityType, alias); }
public BlazeRoot<T> from(Class<T> entityClass, String alias) { EntityType<T> entityType = criteriaBuilder.getEntityMetamodel() .entity(entityClass); if (entityType == null) { throw new IllegalArgumentException(entityClass + " is not an entity"); } return from(entityType, alias); }
@Override public <Y> BlazeJoin<X, Y> join(Class<Y> entityTypeClass, String alias) { return join(criteriaBuilder.getEntityMetamodel().entity(entityTypeClass), alias, DEFAULT_JOIN_TYPE); }
@Override public <Y> BlazeJoin<X, Y> join(Class<Y> entityTypeClass) { return join(criteriaBuilder.getEntityMetamodel().entity(entityTypeClass), null, DEFAULT_JOIN_TYPE); }
@Override public <Y> BlazeJoin<X, Y> join(Class<Y> entityTypeClass, String alias, JoinType joinType) { return join(criteriaBuilder.getEntityMetamodel().entity(entityTypeClass), alias, joinType); }
@Override public <Y> BlazeJoin<X, Y> join(Class<Y> entityTypeClass, JoinType joinType) { return join(criteriaBuilder.getEntityMetamodel().entity(entityTypeClass), null, joinType); }
@Override public <Y> BlazeJoin<X, Y> join(Class<Y> entityTypeClass) { return join(criteriaBuilder.getEntityMetamodel().entity(entityTypeClass), null, DEFAULT_JOIN_TYPE); }
@Override public <Y> BlazeJoin<X, Y> join(Class<Y> entityTypeClass, String alias) { return join(criteriaBuilder.getEntityMetamodel().entity(entityTypeClass), alias, DEFAULT_JOIN_TYPE); }
@Override public <Y> BlazeJoin<X, Y> join(Class<Y> entityTypeClass, String alias, JoinType joinType) { return join(criteriaBuilder.getEntityMetamodel().entity(entityTypeClass), alias, joinType); }
@Override public <Y> BlazeJoin<X, Y> join(Class<Y> entityTypeClass, JoinType joinType) { return join(criteriaBuilder.getEntityMetamodel().entity(entityTypeClass), null, joinType); }
@Override public String determineInheritanceMapping(MetamodelBuildingContext context) { if (inheritanceMapping == null && !inheritanceSupertypes.isEmpty()) { // Check all super type inheritance mappings. If we encounter that a super type uses // an entity class that is not a proper super type of our entity class, we can't infer a type inheritance mapping for (ViewMapping supertypeMapping : inheritanceSupertypes) { Class<?> supertypeEntityClass = supertypeMapping.getEntityClass(); if (!supertypeEntityClass.isAssignableFrom(entityClass) || supertypeEntityClass == entityClass) { return inheritanceMapping; } } // If we get here, we know that our entity class type is a proper subtype of all super type inheritance mappings return "TYPE(this) = " + context.getEntityMetamodel().entity(entityClass).getName(); } return inheritanceMapping; }
protected final void setTreatType(Class<? extends X> treatType) { if (treatType.isAssignableFrom(getJavaType())) { return; } if (treatJoinType != null) { throw new IllegalArgumentException("Invalid multiple invocations of treat on join: " + getPathExpression()); } treatJoinType = criteriaBuilder.getEntityMetamodel().entity(treatType); setJavaType(treatJoinType.getJavaType()); }
protected final void setTreatType(Class<? extends X> treatType) { if (treatType.isAssignableFrom(getJavaType())) { return; } if (treatJoinType != null) { throw new IllegalArgumentException("Invalid multiple invocations of treat on join: " + getPathExpression()); } treatJoinType = criteriaBuilder.getEntityMetamodel().entity(treatType); setJavaType(treatJoinType.getJavaType()); }
protected static javax.persistence.metamodel.SingularAttribute jpaIdOf(EntityViewManagerImpl evm, ManagedViewType<?> subviewType) { if (subviewType instanceof ViewType<?>) { return JpaMetamodelUtils.getSingleIdAttribute(evm.getMetamodel().getEntityMetamodel().entity(subviewType.getEntityClass())); } return null; }
public InverseViewToEntityMapper(EntityViewManagerImpl evm, ViewType<?> childViewType, Mapper<Object, Object> parentEntityOnChildViewMapper, Mapper<Object, Object> parentEntityOnChildEntityAddMapper, Mapper<Object, Object> parentEntityOnChildEntityRemoveMapper, ViewToEntityMapper elementViewToEntityMapper, DirtyAttributeFlusher<?, Object, Object> parentReferenceAttributeFlusher, DirtyAttributeFlusher<?, Object, Object> idAttributeFlusher) { this.elementViewToEntityMapper = elementViewToEntityMapper; this.viewIdAccessor = Accessors.forViewId(evm, childViewType, true); // TODO: this should be the same loader that the viewToEntityMapper uses this.entityLoader = new ReferenceEntityLoader(evm, childViewType, EntityViewUpdaterImpl.createViewIdMapper(evm, childViewType)); this.persistAllowed = false; EntityType<?> entityType = evm.getMetamodel().getEntityMetamodel().entity(childViewType.getEntityClass()); this.parentEntityOnChildViewMapper = parentEntityOnChildViewMapper; this.parentEntityOnChildEntityAddMapper = parentEntityOnChildEntityAddMapper; this.parentEntityOnChildEntityRemoveMapper = parentEntityOnChildEntityRemoveMapper; this.updatePrefixString = "UPDATE " + entityType.getName() + " e SET "; if (idAttributeFlusher == null) { this.updatePostfixString = " WHERE e." + JpaMetamodelUtils.getSingleIdAttribute(entityType).getName() + " = :" + ID_PARAM_NAME; } else { StringBuilder sb = new StringBuilder(); sb.append(" WHERE "); idAttributeFlusher.appendUpdateQueryFragment(null, sb, "e.", "_", " AND "); this.updatePostfixString = sb.toString(); } this.parentReferenceAttributeFlusher = parentReferenceAttributeFlusher; this.idAttributeFlusher = idAttributeFlusher; this.fullUpdateQueryString = createQueryString(null, parentReferenceAttributeFlusher); }