Tabnine Logo
Mappings.getReflectionManager
Code IndexAdd Tabnine to your IDE (free)

How to use
getReflectionManager
method
in
org.hibernate.cfg.Mappings

Best Java code snippets using org.hibernate.cfg.Mappings.getReflectionManager (Showing top 20 results out of 315)

origin: org.hibernate/com.springsource.org.hibernate

public static boolean isDefault(XClass clazz, Mappings mappings) {
  return mappings.getReflectionManager().equals( clazz, void.class );
}
origin: org.hibernate/com.springsource.org.hibernate.core

public static boolean isDefault(XClass clazz, Mappings mappings) {
  return mappings.getReflectionManager().equals( clazz, void.class );
}
origin: org.hibernate/com.springsource.org.hibernate.core

private void getMappedSuperclassesTillNextEntityOrdered() {
  //ordered to allow proper messages on properties subclassing
  XClass currentClassInHierarchy = clazz;
  InheritanceState superclassState;
  do {
    classesToProcessForMappedSuperclass.add( 0, currentClassInHierarchy );
    XClass superClass = currentClassInHierarchy;
    do {
      superClass = superClass.getSuperclass();
      superclassState = inheritanceStatePerClass.get( superClass );
    }
    while ( superClass != null
        && !mappings.getReflectionManager().equals( superClass, Object.class ) && superclassState == null );
    currentClassInHierarchy = superClass;
  }
  while ( superclassState != null && superclassState.isEmbeddableSuperclass() );
}
origin: org.hibernate/com.springsource.org.hibernate

private void getMappedSuperclassesTillNextEntityOrdered() {
  //ordered to allow proper messages on properties subclassing
  XClass currentClassInHierarchy = clazz;
  InheritanceState superclassState;
  do {
    classesToProcessForMappedSuperclass.add( 0, currentClassInHierarchy );
    XClass superClass = currentClassInHierarchy;
    do {
      superClass = superClass.getSuperclass();
      superclassState = inheritanceStatePerClass.get( superClass );
    }
    while ( superClass != null
        && !mappings.getReflectionManager().equals( superClass, Object.class ) && superclassState == null );
    currentClassInHierarchy = superClass;
  }
  while ( superclassState != null && superclassState.isEmbeddableSuperclass() );
}
origin: org.hibernate/com.springsource.org.hibernate

public static XClass getTargetEntity(PropertyData propertyData, Mappings mappings) {
  XProperty property = propertyData.getProperty();
  return mappings.getReflectionManager().toXClass( getTargetEntityClass( property ) );
}
origin: org.hibernate/com.springsource.org.hibernate.core

public static XClass getTargetEntity(PropertyData propertyData, Mappings mappings) {
  XProperty property = propertyData.getProperty();
  return mappings.getReflectionManager().toXClass( getTargetEntityClass( property ) );
}
origin: org.hibernate/com.springsource.org.hibernate

private void buildHierarchyColumnOverride(XClass element) {
  XClass current = element;
  Map<String, Column[]> columnOverride = new HashMap<String, Column[]>();
  Map<String, JoinColumn[]> joinColumnOverride = new HashMap<String, JoinColumn[]>();
  Map<String, JoinTable> joinTableOverride = new HashMap<String, JoinTable>();
  while ( current != null && !mappings.getReflectionManager().toXClass( Object.class ).equals( current ) ) {
    if ( current.isAnnotationPresent( Entity.class ) || current.isAnnotationPresent( MappedSuperclass.class )
        || current.isAnnotationPresent( Embeddable.class ) ) {
      //FIXME is embeddable override?
      Map<String, Column[]> currentOverride = buildColumnOverride( current, getPath() );
      Map<String, JoinColumn[]> currentJoinOverride = buildJoinColumnOverride( current, getPath() );
      Map<String, JoinTable> currentJoinTableOverride = buildJoinTableOverride( current, getPath() );
      currentOverride.putAll( columnOverride ); //subclasses have precedence over superclasses
      currentJoinOverride.putAll( joinColumnOverride ); //subclasses have precedence over superclasses
      currentJoinOverride.putAll( joinColumnOverride ); //subclasses have precedence over superclasses
      columnOverride = currentOverride;
      joinColumnOverride = currentJoinOverride;
      joinTableOverride = currentJoinTableOverride;
    }
    current = current.getSuperclass();
  }
  holderColumnOverride = columnOverride.size() > 0 ? columnOverride : null;
  holderJoinColumnOverride = joinColumnOverride.size() > 0 ? joinColumnOverride : null;
  holderJoinTableOverride = joinTableOverride.size() > 0 ? joinTableOverride : null;
}
origin: org.hibernate/com.springsource.org.hibernate.core

private void addPropertyToMappedSuperclass(Property prop, XClass declaringClass) {
  final Mappings mappings = getMappings();
  final Class type = mappings.getReflectionManager().toClass( declaringClass );
  MappedSuperclass superclass = mappings.getMappedSuperclass( type );
  superclass.addDeclaredProperty( prop );
}
origin: org.hibernate/com.springsource.org.hibernate.core

public static MappedSuperclass getMappedSuperclassOrNull(
    XClass declaringClass,
    Map<XClass, InheritanceState> inheritanceStatePerClass,
    Mappings mappings) {
  boolean retrieve = false;
  if ( declaringClass != null ) {
    final InheritanceState inheritanceState = inheritanceStatePerClass.get( declaringClass );
    if ( inheritanceState == null ) {
      throw new org.hibernate.annotations.common.AssertionFailure(
          "Declaring class is not found in the inheritance state hierarchy: " + declaringClass
      );
    }
    if ( inheritanceState.isEmbeddableSuperclass() ) {
      retrieve = true;
    }
  }
  return retrieve ?
      mappings.getMappedSuperclass( mappings.getReflectionManager().toClass( declaringClass ) ) :
      null;
}
origin: org.hibernate/com.springsource.org.hibernate.core

private void buildHierarchyColumnOverride(XClass element) {
  XClass current = element;
  Map<String, Column[]> columnOverride = new HashMap<String, Column[]>();
  Map<String, JoinColumn[]> joinColumnOverride = new HashMap<String, JoinColumn[]>();
  Map<String, JoinTable> joinTableOverride = new HashMap<String, JoinTable>();
  while ( current != null && !mappings.getReflectionManager().toXClass( Object.class ).equals( current ) ) {
    if ( current.isAnnotationPresent( Entity.class ) || current.isAnnotationPresent( MappedSuperclass.class )
        || current.isAnnotationPresent( Embeddable.class ) ) {
      //FIXME is embeddable override?
      Map<String, Column[]> currentOverride = buildColumnOverride( current, getPath() );
      Map<String, JoinColumn[]> currentJoinOverride = buildJoinColumnOverride( current, getPath() );
      Map<String, JoinTable> currentJoinTableOverride = buildJoinTableOverride( current, getPath() );
      currentOverride.putAll( columnOverride ); //subclasses have precedence over superclasses
      currentJoinOverride.putAll( joinColumnOverride ); //subclasses have precedence over superclasses
      currentJoinOverride.putAll( joinColumnOverride ); //subclasses have precedence over superclasses
      columnOverride = currentOverride;
      joinColumnOverride = currentJoinOverride;
      joinTableOverride = currentJoinTableOverride;
    }
    current = current.getSuperclass();
  }
  holderColumnOverride = columnOverride.size() > 0 ? columnOverride : null;
  holderJoinColumnOverride = joinColumnOverride.size() > 0 ? joinColumnOverride : null;
  holderJoinTableOverride = joinTableOverride.size() > 0 ? joinTableOverride : null;
}
origin: org.hibernate/com.springsource.org.hibernate

private void addPropertyToMappedSuperclass(Property prop, XClass declaringClass) {
  final Mappings mappings = getMappings();
  final Class type = mappings.getReflectionManager().toClass( declaringClass );
  MappedSuperclass superclass = mappings.getMappedSuperclass( type );
  superclass.addDeclaredProperty( prop );
}
origin: org.hibernate/com.springsource.org.hibernate

public static MappedSuperclass getMappedSuperclassOrNull(
    XClass declaringClass,
    Map<XClass, InheritanceState> inheritanceStatePerClass,
    Mappings mappings) {
  boolean retrieve = false;
  if ( declaringClass != null ) {
    final InheritanceState inheritanceState = inheritanceStatePerClass.get( declaringClass );
    if ( inheritanceState == null ) {
      throw new org.hibernate.annotations.common.AssertionFailure(
          "Declaring class is not found in the inheritance state hierarchy: " + declaringClass
      );
    }
    if ( inheritanceState.isEmbeddableSuperclass() ) {
      retrieve = true;
    }
  }
  return retrieve ?
      mappings.getMappedSuperclass( mappings.getReflectionManager().toClass( declaringClass ) ) :
      null;
}
origin: org.hibernate/com.springsource.org.hibernate

@SuppressWarnings({ "unchecked" })
public void setProxy(Proxy proxy) {
  if ( proxy != null ) {
    lazy = proxy.lazy();
    if ( !lazy ) {
      proxyClass = null;
    }
    else {
      if ( AnnotationBinder.isDefault(
          mappings.getReflectionManager().toXClass( proxy.proxyClass() ), mappings
      ) ) {
        proxyClass = annotatedClass;
      }
      else {
        proxyClass = mappings.getReflectionManager().toXClass( proxy.proxyClass() );
      }
    }
  }
  else {
    lazy = true; //needed to allow association lazy loading.
    proxyClass = annotatedClass;
  }
}
origin: org.hibernate/com.springsource.org.hibernate.core

@SuppressWarnings({ "unchecked" })
public void setProxy(Proxy proxy) {
  if ( proxy != null ) {
    lazy = proxy.lazy();
    if ( !lazy ) {
      proxyClass = null;
    }
    else {
      if ( AnnotationBinder.isDefault(
          mappings.getReflectionManager().toXClass( proxy.proxyClass() ), mappings
      ) ) {
        proxyClass = annotatedClass;
      }
      else {
        proxyClass = mappings.getReflectionManager().toXClass( proxy.proxyClass() );
      }
    }
  }
  else {
    lazy = true; //needed to allow association lazy loading.
    proxyClass = annotatedClass;
  }
}
origin: org.hibernate/com.springsource.org.hibernate.core

private void addMappedSuperClassInMetadata(PersistentClass persistentClass) {
  //add @MappedSuperclass in the metadata
  // classes from 0 to n-1 are @MappedSuperclass and should be linked
  org.hibernate.mapping.MappedSuperclass mappedSuperclass = null;
  final InheritanceState superEntityState =
      InheritanceState.getInheritanceStateOfSuperEntity( clazz, inheritanceStatePerClass );
  PersistentClass superEntity =
      superEntityState != null ?
          mappings.getClass( superEntityState.getClazz().getName() ) :
          null;
  final int lastMappedSuperclass = classesToProcessForMappedSuperclass.size() - 1;
  for ( int index = 0; index < lastMappedSuperclass; index++ ) {
    org.hibernate.mapping.MappedSuperclass parentSuperclass = mappedSuperclass;
    final Class<?> type = mappings.getReflectionManager()
        .toClass( classesToProcessForMappedSuperclass.get( index ) );
    //add MAppedSuperclass if not already there
    mappedSuperclass = mappings.getMappedSuperclass( type );
    if ( mappedSuperclass == null ) {
      mappedSuperclass = new org.hibernate.mapping.MappedSuperclass( parentSuperclass, superEntity );
      mappedSuperclass.setMappedClass( type );
      mappings.addMappedSuperclass( type, mappedSuperclass );
    }
  }
  if ( mappedSuperclass != null ) {
    persistentClass.setSuperMappedSuperclass( mappedSuperclass );
  }
}
origin: org.hibernate/com.springsource.org.hibernate

private void addMappedSuperClassInMetadata(PersistentClass persistentClass) {
  //add @MappedSuperclass in the metadata
  // classes from 0 to n-1 are @MappedSuperclass and should be linked
  org.hibernate.mapping.MappedSuperclass mappedSuperclass = null;
  final InheritanceState superEntityState =
      InheritanceState.getInheritanceStateOfSuperEntity( clazz, inheritanceStatePerClass );
  PersistentClass superEntity =
      superEntityState != null ?
          mappings.getClass( superEntityState.getClazz().getName() ) :
          null;
  final int lastMappedSuperclass = classesToProcessForMappedSuperclass.size() - 1;
  for ( int index = 0; index < lastMappedSuperclass; index++ ) {
    org.hibernate.mapping.MappedSuperclass parentSuperclass = mappedSuperclass;
    final Class<?> type = mappings.getReflectionManager()
        .toClass( classesToProcessForMappedSuperclass.get( index ) );
    //add MAppedSuperclass if not already there
    mappedSuperclass = mappings.getMappedSuperclass( type );
    if ( mappedSuperclass == null ) {
      mappedSuperclass = new org.hibernate.mapping.MappedSuperclass( parentSuperclass, superEntity );
      mappedSuperclass.setMappedClass( type );
      mappings.addMappedSuperclass( type, mappedSuperclass );
    }
  }
  if ( mappedSuperclass != null ) {
    persistentClass.setSuperMappedSuperclass( mappedSuperclass );
  }
}
origin: org.hibernate/com.springsource.org.hibernate

  static PropertyData getPropertyOverriddenByMapperOrMapsId(
      boolean isId,
      PropertyHolder propertyHolder,
      String propertyName,
      Mappings mappings) {
    final XClass persistentXClass;
    try {
       persistentXClass = mappings.getReflectionManager()
          .classForName( propertyHolder.getPersistentClass().getClassName(), AnnotationBinder.class );
    }
    catch ( ClassNotFoundException e ) {
      throw new AssertionFailure( "PersistentClass name cannot be converted into a Class", e);
    }
    if ( propertyHolder.isInIdClass() ) {
      PropertyData pd = mappings.getPropertyAnnotatedWithIdAndToOne( persistentXClass, propertyName );
      if ( pd == null && mappings.isSpecjProprietarySyntaxEnabled() ) {
        pd = mappings.getPropertyAnnotatedWithMapsId( persistentXClass, propertyName );
      }
      return pd;
    }
    String propertyPath = isId ? "" : propertyName;
    return mappings.getPropertyAnnotatedWithMapsId(persistentXClass, propertyPath);
  }
}
origin: org.hibernate/com.springsource.org.hibernate.core

  static PropertyData getPropertyOverriddenByMapperOrMapsId(
      boolean isId,
      PropertyHolder propertyHolder,
      String propertyName,
      Mappings mappings) {
    final XClass persistentXClass;
    try {
       persistentXClass = mappings.getReflectionManager()
          .classForName( propertyHolder.getPersistentClass().getClassName(), AnnotationBinder.class );
    }
    catch ( ClassNotFoundException e ) {
      throw new AssertionFailure( "PersistentClass name cannot be converted into a Class", e);
    }
    if ( propertyHolder.isInIdClass() ) {
      PropertyData pd = mappings.getPropertyAnnotatedWithIdAndToOne( persistentXClass, propertyName );
      if ( pd == null && mappings.isSpecjProprietarySyntaxEnabled() ) {
        pd = mappings.getPropertyAnnotatedWithMapsId( persistentXClass, propertyName );
      }
      return pd;
    }
    String propertyPath = isId ? "" : propertyName;
    return mappings.getPropertyAnnotatedWithMapsId(persistentXClass, propertyPath);
  }
}
origin: org.hibernate/com.springsource.org.hibernate.core

public static void bindPackage(String packageName, Mappings mappings) {
  XPackage pckg;
  try {
    pckg = mappings.getReflectionManager().packageForName( packageName );
  }
  catch ( ClassNotFoundException cnf ) {
    LOG.packageNotFound( packageName );
    return;
  }
  if ( pckg.isAnnotationPresent( SequenceGenerator.class ) ) {
    SequenceGenerator ann = pckg.getAnnotation( SequenceGenerator.class );
    IdGenerator idGen = buildIdGenerator( ann, mappings );
    mappings.addGenerator( idGen );
    if ( LOG.isTraceEnabled() ) {
      LOG.tracev( "Add sequence generator with name: {0}", idGen.getName() );
    }
  }
  if ( pckg.isAnnotationPresent( TableGenerator.class ) ) {
    TableGenerator ann = pckg.getAnnotation( TableGenerator.class );
    IdGenerator idGen = buildIdGenerator( ann, mappings );
    mappings.addGenerator( idGen );
  }
  bindGenericGenerators( pckg, mappings );
  bindQueries( pckg, mappings );
  bindFilterDefs( pckg, mappings );
  bindTypeDefs( pckg, mappings );
  bindFetchProfiles( pckg, mappings );
  BinderHelper.bindAnyMetaDefs( pckg, mappings );
}
origin: org.hibernate/com.springsource.org.hibernate

public static void bindPackage(String packageName, Mappings mappings) {
  XPackage pckg;
  try {
    pckg = mappings.getReflectionManager().packageForName( packageName );
  }
  catch ( ClassNotFoundException cnf ) {
    LOG.packageNotFound( packageName );
    return;
  }
  if ( pckg.isAnnotationPresent( SequenceGenerator.class ) ) {
    SequenceGenerator ann = pckg.getAnnotation( SequenceGenerator.class );
    IdGenerator idGen = buildIdGenerator( ann, mappings );
    mappings.addGenerator( idGen );
    if ( LOG.isTraceEnabled() ) {
      LOG.tracev( "Add sequence generator with name: {0}", idGen.getName() );
    }
  }
  if ( pckg.isAnnotationPresent( TableGenerator.class ) ) {
    TableGenerator ann = pckg.getAnnotation( TableGenerator.class );
    IdGenerator idGen = buildIdGenerator( ann, mappings );
    mappings.addGenerator( idGen );
  }
  bindGenericGenerators( pckg, mappings );
  bindQueries( pckg, mappings );
  bindFilterDefs( pckg, mappings );
  bindTypeDefs( pckg, mappings );
  bindFetchProfiles( pckg, mappings );
  BinderHelper.bindAnyMetaDefs( pckg, mappings );
}
org.hibernate.cfgMappingsgetReflectionManager

Popular methods of Mappings

  • addClass
    Add entity mapping metadata.
  • addImport
    Adds an import (HQL entity rename) to the repository.
  • addTable
    Adds table metadata to this repository returning the created metadata instance.
  • getCatalogName
    Returns the currently bound default catalog name.
  • getClass
    Retrieves the entity mapping metadata for the given entity name.
  • getSchemaName
    Returns the currently bound default schema name.
  • addCollection
    Add collection mapping metadata to this repository.
  • addSecondPass
    Adds a second pass.
  • addTableBinding
    Adds a table binding to this repository.
  • getDefaultAccess
    Get the current default property access style.
  • isAutoImport
    Determine whether auto importing of entity names is currently enabled.
  • addDenormalizedTable
    Adds a 'denormalized table' to this repository.
  • isAutoImport,
  • addDenormalizedTable,
  • addFilterDefinition,
  • addTypeDef,
  • addUniquePropertyReference,
  • getObjectNameNormalizer,
  • setAutoImport,
  • addColumnBinding,
  • addPropertyReference,
  • addQuery

Popular in Java

  • Reactive rest calls using spring rest template
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • notifyDataSetChanged (ArrayAdapter)
  • setScale (BigDecimal)
  • Point (java.awt)
    A point representing a location in (x,y) coordinate space, specified in integer precision.
  • Selector (java.nio.channels)
    A controller for the selection of SelectableChannel objects. Selectable channels can be registered w
  • Iterator (java.util)
    An iterator over a sequence of objects, such as a collection.If a collection has been changed since
  • LinkedHashMap (java.util)
    LinkedHashMap is an implementation of Map that guarantees iteration order. All optional operations a
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • CodeWhisperer alternatives
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