public MapKeyAttribute(CriteriaBuilderImpl criteriaBuilder, MapAttribute<?, K, ?> attribute) { this.attribute = attribute; this.jpaType = attribute.getKeyType(); this.jpaBinableJavaType = attribute.getKeyJavaType(); this.jpaBindableType = Type.PersistenceType .ENTITY.equals( jpaType.getPersistenceType() ) ? BindableType.ENTITY_TYPE : BindableType.SINGULAR_ATTRIBUTE; String guessedRoleName = determineRole( attribute ); SessionFactoryImplementor sfi = criteriaBuilder.getEntityManagerFactory().getSessionFactory(); mapPersister = sfi.getCollectionPersister( guessedRoleName ); if ( mapPersister == null ) { throw new IllegalStateException( "Could not locate collection persister [" + guessedRoleName + "]" ); } mapKeyType = mapPersister.getIndexType(); if ( mapKeyType == null ) { throw new IllegalStateException( "Could not determine map-key type [" + guessedRoleName + "]" ); } this.persistentAttributeType = mapKeyType.isEntityType() ? PersistentAttributeType.MANY_TO_ONE : mapKeyType.isComponentType() ? PersistentAttributeType.EMBEDDED : PersistentAttributeType.BASIC; }
private <Y> JoinImplementor<X, Y> constructJoin(SingularAttribute<? super X, Y> attribute, JoinType jt) { if ( Type.PersistenceType.BASIC.equals( attribute.getType().getPersistenceType() ) ) { throw new BasicPathUsageException( "Cannot join to attribute of basic type", attribute ); } // TODO : runtime check that the attribute in fact belongs to this From's model/bindable if ( jt.equals( JoinType.RIGHT ) ) { throw new UnsupportedOperationException( "RIGHT JOIN not supported" ); } final Class<Y> attributeType = attribute.getBindableJavaType(); return new SingularAttributeJoin<X, Y>( criteriaBuilder(), attributeType, this, attribute, jt ); }
/** * Returns true, if attribute is embeddable. * * @param embeddableClazz * class for embeddable type attribute. * @return try, if paramterized class is of embeddable java type. */ public boolean isEmbeddable(Class embeddableClazz) { return embeddables != null ? embeddables.containsKey(embeddableClazz) && embeddables.get(embeddableClazz).getPersistenceType().equals(PersistenceType.EMBEDDABLE) : false; }
public boolean isBasicCollection() { return Type.PersistenceType.BASIC.equals( getAttribute().getElementType().getPersistenceType() ); }
public boolean isBasicCollection() { return Type.PersistenceType.BASIC.equals(getAttribute().getElementType().getPersistenceType()); }
@Override public boolean isBasicCollection() { return Type.PersistenceType.BASIC.equals(this.getAttribute().getElementType().getPersistenceType()); }
public MapKeyAttribute(MapAttribute<?, Y, ?> attribute) { this.attribute = attribute; Type<Y> jpaType = attribute.getKeyType(); this.jpaBindableType = Type.PersistenceType.ENTITY .equals(jpaType.getPersistenceType()) ? BindableType.ENTITY_TYPE : BindableType.SINGULAR_ATTRIBUTE; this.persistentAttributeType = Type.PersistenceType.ENTITY .equals(jpaType.getPersistenceType()) ? PersistentAttributeType.MANY_TO_ONE : Type.PersistenceType.EMBEDDABLE .equals(jpaType.getPersistenceType()) ? PersistentAttributeType.EMBEDDED : PersistentAttributeType.BASIC; }
public Path<K> key() { if (this.getModel().getKeyType().getPersistenceType().equals(PersistenceType.BASIC)){ return new PathImpl(this, metamodel, ((MapAttribute)this.modelArtifact).getKeyJavaType(), this.currentNode.mapKey(), this.getModel()); } return new JoinImpl(this, (ManagedType)this.getModel().getKeyType(), metamodel, this.getModel().getKeyJavaType(), this.currentNode.mapKey(), this.getModel()); }
private <Y> AbstractJoin<X, Y> constructJoin(SingularAttribute<? super X, Y> attribute, String alias, JoinType jt) { if (Type.PersistenceType.BASIC.equals(attribute.getType().getPersistenceType())) { throw new IllegalArgumentException("Cannot join to attribute of basic type: " + attribute.getJavaType().getName()); } checkJoin(attribute, jt); final Class<Y> attributeType = attribute.getBindableJavaType(); SingularAttributeJoin<X, Y> join = new SingularAttributeJoin<X, Y>(criteriaBuilder, attributeType, this, attribute, jt); join.setAlias(alias); return join; }
private <Y> AbstractJoin<X, Y> constructJoin(SingularAttribute<? super X, Y> attribute, String alias, JoinType jt) { if (Type.PersistenceType.BASIC.equals(attribute.getType().getPersistenceType())) { throw new IllegalArgumentException("Cannot join to attribute of basic type: " + attribute.getJavaType().getName()); } checkJoin(attribute, jt); final Class<Y> attributeType = attribute.getBindableJavaType(); SingularAttributeJoin<X, Y> join = new SingularAttributeJoin<X, Y>(criteriaBuilder, attributeType, this, attribute, jt); join.setAlias(alias); return join; }
public MapKeyAttribute(MapAttribute<?, Y, ?> attribute) { this.attribute = attribute; Type<Y> jpaType = attribute.getKeyType(); this.jpaBindableType = Type.PersistenceType.ENTITY .equals(jpaType.getPersistenceType()) ? BindableType.ENTITY_TYPE : BindableType.SINGULAR_ATTRIBUTE; this.persistentAttributeType = Type.PersistenceType.ENTITY .equals(jpaType.getPersistenceType()) ? PersistentAttributeType.MANY_TO_ONE : Type.PersistenceType.EMBEDDABLE .equals(jpaType.getPersistenceType()) ? PersistentAttributeType.EMBEDDED : PersistentAttributeType.BASIC; }
public Join<Map<K, V>, K> joinKey(JoinType jt) { if (this.getModel().getKeyType().getPersistenceType().equals(PersistenceType.BASIC)){ throw new IllegalStateException(ExceptionLocalization.buildMessage("attemped_to_join_basic_key")); } return new JoinImpl(this, (ManagedType)this.getModel().getKeyType(), metamodel, this.getModel().getKeyJavaType(), this.currentNode.mapKey(), this.getModel()); }
public <T> CriteriaUpdate<T> createCriteriaUpdate(Class<T> targetEntity) { if (targetEntity != null) { TypeImpl type = ((MetamodelImpl)this.metamodel).getType(targetEntity); if (type != null && type.getPersistenceType().equals(PersistenceType.ENTITY)) { return new CriteriaUpdateImpl(this.metamodel, this, targetEntity); } } throw new IllegalArgumentException(ExceptionLocalization.buildMessage("unknown_bean_class", new Object[] { targetEntity })); }
public <T> CriteriaDelete<T> createCriteriaDelete(Class<T> targetEntity) { if (targetEntity != null) { TypeImpl type = ((MetamodelImpl)this.metamodel).getType(targetEntity); if (type != null && type.getPersistenceType().equals(PersistenceType.ENTITY)) { return new CriteriaDeleteImpl(this.metamodel, this, targetEntity); } } throw new IllegalArgumentException(ExceptionLocalization.buildMessage("unknown_bean_class", new Object[] { targetEntity })); }
public MapKeyAttribute(BlazeCriteriaBuilderImpl criteriaBuilder, MapAttribute<?, K, ?> attribute) { this.attribute = attribute; this.jpaType = attribute.getKeyType(); this.jpaBinableJavaType = attribute.getKeyJavaType(); this.jpaBindableType = Type.PersistenceType.ENTITY .equals(jpaType.getPersistenceType()) ? BindableType.ENTITY_TYPE : BindableType.SINGULAR_ATTRIBUTE; this.persistentAttributeType = Type.PersistenceType.ENTITY .equals(jpaType.getPersistenceType()) ? PersistentAttributeType.MANY_TO_ONE : Type.PersistenceType.EMBEDDABLE .equals(jpaType.getPersistenceType()) ? PersistentAttributeType.EMBEDDED : PersistentAttributeType.BASIC; }
public MapKeyAttribute(BlazeCriteriaBuilderImpl criteriaBuilder, MapAttribute<?, K, ?> attribute) { this.attribute = attribute; this.jpaType = attribute.getKeyType(); this.jpaBinableJavaType = attribute.getKeyJavaType(); this.jpaBindableType = Type.PersistenceType.ENTITY .equals(jpaType.getPersistenceType()) ? BindableType.ENTITY_TYPE : BindableType.SINGULAR_ATTRIBUTE; this.persistentAttributeType = Type.PersistenceType.ENTITY .equals(jpaType.getPersistenceType()) ? PersistentAttributeType.MANY_TO_ONE : Type.PersistenceType.EMBEDDABLE .equals(jpaType.getPersistenceType()) ? PersistentAttributeType.EMBEDDED : PersistentAttributeType.BASIC; }
if (!embeddedColumn.getPersistenceType().equals(PersistenceType.EMBEDDABLE) || compositeEmbeddables.contains(embeddedColumn.getJavaType().getSimpleName()))
if (superClazzType.getPersistenceType().equals(PersistenceType.ENTITY) && superClazzType.getJavaType().isAnnotationPresent(Inheritance.class))
public boolean isBasicCollection() { return Type.PersistenceType.BASIC.equals( getAttribute().getElementType().getPersistenceType() ); }