Tabnine Logo
SessionImplementor.getSessionFactory
Code IndexAdd Tabnine to your IDE (free)

How to use
getSessionFactory
method
in
org.hibernate.engine.spi.SessionImplementor

Best Java code snippets using org.hibernate.engine.spi.SessionImplementor.getSessionFactory (Showing top 20 results out of 315)

origin: hibernate/hibernate-orm

@Override
public SessionFactoryImplementor getSessionFactory() {
  return delegate.getSessionFactory();
}
origin: hibernate/hibernate-orm

/**
 * Parses the textual graph representation  into the specified graph.
 *
 * @param graph The target graph.  This is the graph that will be populated by this process
 * @param graphText Textual representation of the graph
 * @param entityManager The EntityManager
 *
 * @throws InvalidGraphException if the textual representation is invalid.
 */
@SuppressWarnings("unchecked")
public static <T> void parseInto(
    final Subgraph<T> graph,
    final CharSequence graphText,
    final EntityManager entityManager) {
  parseInto(
      (GraphImplementor<T>) graph,
      graphText,
      ( (SessionImplementor) entityManager ).getSessionFactory()
  );
}
origin: hibernate/hibernate-orm

/**
 * Parses the textual graph representation  into the specified graph.
 *
 * @param graph The target graph.  This is the graph that will be populated by this process
 * @param graphText Textual representation of the graph
 * @param entityManager The EntityManager
 *
 * @throws InvalidGraphException if the textual representation is invalid.
 */
@SuppressWarnings("unchecked")
public static <T> void parseInto(
    final EntityGraph<T> graph,
    final CharSequence graphText,
    final EntityManager entityManager) {
  parseInto(
      (GraphImplementor<T>) graph,
      graphText,
      ( (SessionImplementor) entityManager ).getSessionFactory()
  );
}
origin: hibernate/hibernate-orm

/**
 * Parses the textual graph representation  into the specified graph.
 *
 * @param graph The target graph.  This is the graph that will be populated by this process
 * @param graphText Textual representation of the graph
 * @param entityManager The EntityManager
 *
 * @throws InvalidGraphException if the textual representation is invalid.
 */
public static <T> void parseInto(
    final Graph<T> graph,
    final CharSequence graphText,
    final EntityManager entityManager) {
  parseInto(
      (GraphImplementor<T>) graph,
      graphText,
      ( (SessionImplementor) entityManager ).getSessionFactory()
  );
}
origin: hibernate/hibernate-orm

private static <T> RootGraphImplementor<T> parse(
    final Class<T> rootType,
    final CharSequence graphText,
    final SessionImplementor session) {
  if ( graphText == null ) {
    return null;
  }
  final RootGraphImplementor<T> graph = session.createEntityGraph( rootType );
  parseInto( (GraphImplementor<T>) graph, graphText, session.getSessionFactory() );
  return graph;
}
origin: hibernate/hibernate-orm

  private boolean isNonIdentifierWhereConditionsRequired(String entityName, String propertyName, SessionImplementor session) {
    final Type propertyType = session.getSessionFactory().getMetamodel().entityPersister( entityName ).getPropertyType( propertyName );
    if ( propertyType.isCollectionType() ) {
      final CollectionType collectionType = (CollectionType) propertyType;
      final Type collectionElementType = collectionType.getElementType( session.getSessionFactory() );
      if ( collectionElementType instanceof ComponentType ) {
        // required for Embeddables
        return true;
      }
      else if ( collectionElementType instanceof MaterializedClobType || collectionElementType instanceof MaterializedNClobType ) {
        // for Map<> using @Lob annotations
        return collectionType instanceof MapType;
      }
    }
    return false;
  }
}
origin: hibernate/hibernate-orm

  /**
   * Get the property type of a given property in the specified entity.
   *
   * @param session      the session
   * @param entityName   the entity name
   * @param propertyName the property name
   * @return the property type of the property or {@code null} if the property name isn't found.
   */
  private Type getPropertyType(SessionImplementor session, String entityName, String propertyName) {
    // rather than rely on QueryException from calling getPropertyType(), this allows a non-failure way
    // to determine whether to return null or lookup the value safely.
    final EntityPersister persister = session.getSessionFactory().getMetamodel().entityPersister( entityName );
    for ( String name : persister.getPropertyNames() ) {
      if ( name.equals( propertyName ) ) {
        return persister.getPropertyType( propertyName );
      }
    }
    return null;
  }
}
origin: hibernate/hibernate-orm

final List<ImplicitParameterBinding> implicitParameterBindings = new ArrayList<>();
final SessionFactoryImplementor sessionFactory = entityManager.getSessionFactory();
origin: hibernate/hibernate-orm

CollectionType collectionType = (CollectionType) type;
final SessionFactoryImplementor sessionFactory = ( (SessionImplementor) action.getSession() )
    .getSessionFactory();
if ( collectionType.getElementType( sessionFactory ).isEntityType() &&
    !sessionFactory.getMetamodel().collectionPersister( collectionType.getRole() ).isManyToMany() ) {
origin: hibernate/hibernate-orm

  private void assertEnumProperty(Class<?> entityClass, Class<?> typeClass, String propertyName, EnumType expectedType) {
    doInJPA( this::entityManagerFactory, entityManager -> {
      final SessionFactoryImplementor sessionFactory = entityManager.unwrap( SessionImplementor.class ).getSessionFactory();

      final EntityPersister entityPersister = sessionFactory.getMetamodel().entityPersister( entityClass );
      final EnversService enversService = sessionFactory.getServiceRegistry().getService( EnversService.class );

      final String entityName = entityPersister.getEntityName();
      final String auditEntityName = enversService.getAuditEntitiesConfiguration().getAuditEntityName( entityName );

      final EntityPersister auditedEntityPersister = sessionFactory.getMetamodel().entityPersister( auditEntityName );

      final org.hibernate.type.Type propertyType = auditedEntityPersister.getPropertyType( propertyName );
      assertTyping( CustomType.class, propertyType );

      final UserType userType = ( (CustomType) propertyType ).getUserType();
      assertTyping( typeClass, userType );
      assertTyping( org.hibernate.type.EnumType.class, userType );

      switch ( expectedType ) {
        case STRING:
          assertTrue( !( (org.hibernate.type.EnumType) userType ).isOrdinal() );
          break;
        default:
          assertTrue( ( (org.hibernate.type.EnumType) userType ).isOrdinal() );
          break;
      }
    } );
  }
}
origin: org.hibernate.orm/hibernate-core

@Override
public SessionFactoryImplementor getSessionFactory() {
  return delegate.getSessionFactory();
}
origin: com.atlassian.hibernate/hibernate.adapter

@Override
public SessionFactoryImplementor getSessionFactory() {
  return getSessionImplementor().getSessionFactory();
}
origin: hibernate/hibernate-search

  private HibernateOrmSearchManager getSearchManager() {
    if ( searchManager == null ) {
      HibernateSearchContextService contextService = delegate.getSessionFactory().getServiceRegistry()
          .getService( HibernateSearchContextService.class );
      searchManager = contextService.getSearchManager( delegate );
    }
    return searchManager;
  }
}
origin: org.hibernate.orm/hibernate-core

  @Override
  public Object run() {
    final Setter setter = ReflectionTools.getSetter(
        obj.getClass(),
        propertyData,
        versionsReader.getSessionImplementor().getSessionFactory().getServiceRegistry()
    );
    // We only set a null value if the field is not primitive. Otherwise, we leave it intact.
    if ( value != null || !isPrimitive( setter, propertyData, obj.getClass() ) ) {
      setter.set( obj, value, null );
    }
    return null;
  }
};
origin: org.hibernate.orm/hibernate-core

  @Override
  public Object run() {
    final Setter setter = ReflectionTools.getSetter(
        obj.getClass(),
        collectionPropertyData,
        versionsReader.getSessionImplementor().getSessionFactory().getServiceRegistry()
    );
    setter.set( obj, collectionProxy, null );
    return null;
  }
};
origin: org.hibernate.orm/hibernate-core

private static <T> RootGraphImplementor<T> parse(
    final Class<T> rootType,
    final CharSequence graphText,
    final SessionImplementor session) {
  if ( graphText == null ) {
    return null;
  }
  final RootGraphImplementor<T> graph = session.createEntityGraph( rootType );
  parseInto( (GraphImplementor<T>) graph, graphText, session.getSessionFactory() );
  return graph;
}
origin: hibernate/hibernate-search

  private HibernateOrmSearchManagerBuilder createSearchManagerBuilder(EntityManager entityManager) {
    SessionImplementor sessionImplementor = entityManager.unwrap( SessionImplementor.class );

    SessionFactory expectedSessionFactory = mappingContext.getSessionFactory();
    SessionFactory givenSessionFactory = sessionImplementor.getSessionFactory();

    if ( !givenSessionFactory.equals( expectedSessionFactory ) ) {
      throw log.usingDifferentSessionFactories( expectedSessionFactory, givenSessionFactory );
    }

    return new HibernateOrmSearchManagerImpl.HibernateOrmSearchManagerBuilderImpl( getDelegate(), mappingContext, sessionImplementor );
  }
}
origin: org.hibernate.orm/hibernate-core

public AuditReaderImpl(Session session, boolean closeable) {
  this.session = session;
  this.sessionImplementor = (SessionImplementor) session;
  this.closeable = closeable;
  final ServiceRegistry serviceRegistry = this.sessionImplementor.getSessionFactory().getServiceRegistry();
  this.auditService = serviceRegistry.getService( AuditService.class );
  firstLevelCache = new FirstLevelCache();
  crossTypeRevisionChangesReader = new CrossTypeRevisionChangesReaderImpl( this );
}
origin: hibernate/hibernate-search

  public static boolean areDocIdAndEntityIdIdentical(EntityInfo entityInfo, SessionImplementor session) {
    SessionFactoryImplementor sessionFactoryImplementor = session.getSessionFactory();
    ClassMetadata cm = sessionFactoryImplementor.getMetamodel().entityPersister( entityInfo.getType().getName() ).getClassMetadata();
    String hibernateIdentifierProperty = cm.getIdentifierPropertyName();
    return entityInfo.getIdName().equals( hibernateIdentifierProperty );
  }
}
origin: hibernate/hibernate-search

private static TransactionManager lookupTransactionManager(SessionImplementor session) {
  return session
      .getSessionFactory()
      .getServiceRegistry()
      .getService( JtaPlatform.class )
      .retrieveTransactionManager();
}
org.hibernate.engine.spiSessionImplementorgetSessionFactory

Popular methods of SessionImplementor

  • getFactory
    Get the creating SessionFactoryImplementor
  • getTransactionCoordinator
  • connection
  • getPersistenceContext
    Get the persistence context for this session
  • getLoadQueryInfluencers
    Get the load query influencers associated with this session.
  • isTransactionInProgress
    Does this Session have an active Hibernate transaction or is there a JTA transaction in progress?
  • getEntityPersister
    Get the EntityPersister for any instance
  • getJdbcCoordinator
  • isClosed
    Determine whether the session is closed. Provided separately from #isOpen() as this method does not
  • flush
  • getTenantIdentifier
    Match te method on org.hibernate.Session and org.hibernate.StatelessSession
  • generateEntityKey
  • getTenantIdentifier,
  • generateEntityKey,
  • getContextEntityIdentifier,
  • isOpen,
  • bestGuessEntityName,
  • getFlushMode,
  • guessEntityName,
  • immediateLoad,
  • initializeCollection

Popular in Java

  • Creating JSON documents from java classes using gson
  • getExternalFilesDir (Context)
  • runOnUiThread (Activity)
  • getApplicationContext (Context)
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • URI (java.net)
    A Uniform Resource Identifier that identifies an abstract or physical resource, as specified by RFC
  • Date (java.util)
    A specific moment in time, with millisecond precision. Values typically come from System#currentTime
  • SortedSet (java.util)
    SortedSet is a Set which iterates over its elements in a sorted order. The order is determined eithe
  • Manifest (java.util.jar)
    The Manifest class is used to obtain attribute information for a JarFile and its entries.
  • JCheckBox (javax.swing)
  • From CI to AI: The AI layer in your organization
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