Tabnine Logo
javax.persistence.metamodel
Code IndexAdd Tabnine to your IDE (free)

How to use javax.persistence.metamodel

Best Java code snippets using javax.persistence.metamodel (Showing top 20 results out of 1,044)

origin: hibernate/hibernate-orm

public AbstractJoinImpl(
    CriteriaBuilderImpl criteriaBuilder,
    Class<X> javaType,
    PathSource<Z> pathSource,
    Attribute<? super Z, ?> joinAttribute,
    JoinType joinType) {
  super( criteriaBuilder, javaType, pathSource );
  this.joinAttribute = joinAttribute;
  this.joinType = joinType;
}
origin: hibernate/hibernate-orm

private ManagedType<X> resolveManagedType(SingularAttribute<?, X> attribute) {
  if ( Attribute.PersistentAttributeType.BASIC == attribute.getPersistentAttributeType() ) {
    return null;
  }
  else if ( Attribute.PersistentAttributeType.EMBEDDED == attribute.getPersistentAttributeType() ) {
    return (EmbeddableType<X>) attribute.getType();
  }
  else {
    return (IdentifiableType<X>) attribute.getType();
  }
}
origin: hibernate/hibernate-orm

public RootImpl(CriteriaBuilderImpl criteriaBuilder, EntityType<X> entityType, boolean allowJoins) {
  super( criteriaBuilder, entityType.getJavaType() );
  this.entityType = entityType;
  this.allowJoins = allowJoins;
}
origin: kiegroup/jbpm

private String [] createOriginalAndExpectedKeys(Attribute embeddedAttr, PluralAttribute listAttr) { 
  String originalKey = embeddedAttr.getDeclaringType().getJavaType().getName() 
      + "." + embeddedAttr.getName()
      + "." + listAttr.getName();
  
  String copyKey = listAttr.getDeclaringType().getJavaType().getName()
      + "." + listAttr.getName(); 
  String [] keys = { originalKey, copyKey };
  return keys;
}

origin: spring-projects/spring-data-jpa

private String tryFindSingularIdAttributeNameOrUseFallback(Class<? extends Object> idPropertyValueType,
    String fallbackIdTypePropertyName) {
  ManagedType<? extends Object> idPropertyType = metamodel.managedType(idPropertyValueType);
  for (SingularAttribute<?, ?> sa : idPropertyType.getSingularAttributes()) {
    if (sa.isId()) {
      return sa.getName();
    }
  }
  return fallbackIdTypePropertyName;
}
origin: hibernate/hibernate-orm

@Override
@SuppressWarnings({"unchecked"})
public <X, K, V> MapJoin<X, K, V> joinMap(String attributeName, JoinType jt) {
  final Attribute<X, ?> attribute = (Attribute<X, ?>) locateAttribute( attributeName );
  if ( !attribute.isCollection() ) {
    throw new IllegalArgumentException( "Requested attribute was not a map" );
  }
  final PluralAttribute pluralAttribute = (PluralAttribute) attribute;
  if ( !PluralAttribute.CollectionType.MAP.equals( pluralAttribute.getCollectionType() ) ) {
    throw new IllegalArgumentException( "Requested attribute was not a map" );
  }
  return (MapJoin<X, K, V>) join( (MapAttribute) attribute, jt );
}
origin: hibernate/hibernate-orm

private String determineRole(MapAttribute<?,K,?> attribute) {
  return attribute.getDeclaringType().getJavaType().getName() +
      '.' + attribute.getName();
}
origin: spring-projects/spring-data-jpa

@SuppressWarnings("unchecked")
public IdMetadata(IdentifiableType<T> source) {
  this.type = source;
  this.attributes = (Set<SingularAttribute<? super T, ?>>) (source.hasSingleIdAttribute()
      ? Collections.singleton(source.getId(source.getIdType().getJavaType()))
      : source.getIdClassAttributes());
}
origin: hibernate/hibernate-orm

public boolean isBasicCollection() {
  return Type.PersistenceType.BASIC.equals( getAttribute().getElementType().getPersistenceType() );
}
origin: stackoverflow.com

 CriteriaQuery<Pet> cq = cb.createQuery(Pet.class);
Metamodel m = em.getMetamodel();
EntityType<Pet> Pet_ = m.entity(Pet.class);
EntityType<Owner> Owner_ = m.entity(Owner.class);

Root<Pet> pet = cq.from(Pet.class);
Join<Owner, Address> address = cq.join(Pet_.owners).join(Owner_.addresses);
origin: hibernate/hibernate-orm

  @Override
  @SuppressWarnings("unchecked")
  default Class<J> getClassType() {
    return getGraphedType().getJavaType();
  }
}
origin: hibernate/hibernate-orm

@Override
@SuppressWarnings({"unchecked"})
protected Attribute<X, ?> locateAttributeInternal(String name) {
  return (Attribute<X, ?>) locateManagedType().getAttribute( name );
}
origin: hibernate/hibernate-orm

@Override
protected ManagedType<E> locateManagedType() {
  return isBasicCollection()
      ? null
      : (ManagedType<E>) getAttribute().getElementType();
}
origin: hibernate/hibernate-orm

@Override
public Class<K> getJavaType() {
  return attribute.getKeyJavaType();
}
origin: hibernate/hibernate-orm

public PluralAttributePath(
    CriteriaBuilderImpl criteriaBuilder,
    PathSource source,
    PluralAttribute<?,X,?> attribute) {
  super( criteriaBuilder, attribute.getJavaType(), source );
  this.attribute = attribute;
  this.persister = resolvePersister( criteriaBuilder, attribute );
}
origin: hibernate/hibernate-orm

@Override
@SuppressWarnings({"unchecked"})
public <X, Y> SetJoin<X, Y> joinSet(String attributeName, JoinType jt) {
  final Attribute<X, ?> attribute = (Attribute<X, ?>) locateAttribute( attributeName );
  if ( !attribute.isCollection() ) {
    throw new IllegalArgumentException( "Requested attribute was not a set" );
  }
  final PluralAttribute pluralAttribute = (PluralAttribute) attribute;
  if ( !PluralAttribute.CollectionType.SET.equals( pluralAttribute.getCollectionType() ) ) {
    throw new IllegalArgumentException( "Requested attribute was not a set" );
  }
  return (SetJoin<X, Y>) join( (SetAttribute) attribute, jt );
}
origin: stackoverflow.com

 CriteriaQuery<Pet> cq = cb.createQuery(Pet.class);
Metamodel m = em.getMetamodel();
EntityType<Pet> Pet_ = m.entity(Pet.class);

Root<Pet> pet = cq.from(Pet.class);
Join<Pet, Owner> owner = pet.join(Pet_.owners);
origin: hibernate/hibernate-orm

private <K,V> void checkMapKeyType(MapAttribute<? super J, K, V> mapAttribute, String name, Class<K> keyType) {
  if ( mapAttribute.getKeyJavaType() != keyType ) {
    throw new IllegalArgumentException( "MapAttribute named " + name + " does not support a key of type " + keyType );
  }
}
origin: hibernate/hibernate-orm

@Override
@SuppressWarnings({"unchecked"})
public <X, Y> CollectionJoin<X, Y> joinCollection(String attributeName, JoinType jt) {
  final Attribute<X, ?> attribute = (Attribute<X, ?>) locateAttribute( attributeName );
  if ( !attribute.isCollection() ) {
    throw new IllegalArgumentException( "Requested attribute was not a collection" );
  }
  final PluralAttribute pluralAttribute = (PluralAttribute) attribute;
  if ( !PluralAttribute.CollectionType.COLLECTION.equals( pluralAttribute.getCollectionType() ) ) {
    throw new IllegalArgumentException( "Requested attribute was not a collection" );
  }
  return (CollectionJoin<X, Y>) join( (CollectionAttribute) attribute, jt );
}
origin: hibernate/hibernate-orm

@Override
@SuppressWarnings({"unchecked"})
public <X, Y> ListJoin<X, Y> joinList(String attributeName, JoinType jt) {
  final Attribute<X, ?> attribute = (Attribute<X, ?>) locateAttribute( attributeName );
  if ( !attribute.isCollection() ) {
    throw new IllegalArgumentException( "Requested attribute was not a list" );
  }
  final PluralAttribute pluralAttribute = (PluralAttribute) attribute;
  if ( !PluralAttribute.CollectionType.LIST.equals( pluralAttribute.getCollectionType() ) ) {
    throw new IllegalArgumentException( "Requested attribute was not a list" );
  }
  return (ListJoin<X, Y>) join( (ListAttribute) attribute, jt );
}
javax.persistence.metamodel

Most used classes

  • EntityType
    Instances of the type EntityType represent entity types.
  • SingularAttribute
    Instances of the type SingularAttribute represents persistent single-valued properties or fields.
  • Metamodel
    Provides access to the metamodel of persistent entities in the persistence unit.
  • Attribute
    Represents an attribute of a Java type.
  • StaticMetamodel
  • Type,
  • PluralAttribute,
  • EmbeddableType,
  • MapAttribute,
  • IdentifiableType,
  • Type$PersistenceType,
  • Bindable,
  • Attribute$PersistentAttributeType,
  • ListAttribute,
  • SetAttribute,
  • CollectionAttribute,
  • PluralAttribute$CollectionType,
  • MappedSuperclassType
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now