Tabnine Logo
SessionImpl.getFactory
Code IndexAdd Tabnine to your IDE (free)

How to use
getFactory
method
in
org.hibernate.impl.SessionImpl

Best Java code snippets using org.hibernate.impl.SessionImpl.getFactory (Showing top 10 results out of 315)

origin: sk.seges.corpis/corpis-dao-impl

  @SuppressWarnings("unchecked")
  @Transactional
  public void createSequence(String sequenceName, Integer initialValue,
      Integer incrementSize) {
    SessionImpl imp = (SessionImpl) entityManager.getDelegate();
    String sa = imp.getFactory().getDialect().getQuerySequencesString();
    List<String> sequences = entityManager.createNativeQuery(sa)
        .getResultList();
    for (String sequence : sequences) {
      if (sequence.toLowerCase().equals(sequenceName.toLowerCase())) {
        return;
      }
    }
    String sql = imp.getFactory().getDialect().getCreateSequenceStrings(
        sequenceName, initialValue, incrementSize)[0];
    entityManager.createNativeQuery(sql).executeUpdate();
  }
}
origin: jboss.jboss-embeddable-ejb3/hibernate-all

/**
 * Load the data for the object with the specified id into a newly created object.
 * This is only called when lazily initializing a proxy.
 * Do NOT return a proxy.
 */
public Object immediateLoad(String entityName, Serializable id) throws HibernateException {
  if ( log.isDebugEnabled() ) {
    EntityPersister persister = getFactory().getEntityPersister(entityName);
    log.debug( "initializing proxy: " + MessageHelper.infoString( persister, id, getFactory() ) );
  }
  
  LoadEvent event = new LoadEvent(id, entityName, true, this);
  fireLoad(event, LoadEventListener.IMMEDIATE_LOAD);
  return event.getResult();
}
origin: hibernate/hibernate

/**
 * Load the data for the object with the specified id into a newly created object.
 * This is only called when lazily initializing a proxy.
 * Do NOT return a proxy.
 */
public Object immediateLoad(String entityName, Serializable id) throws HibernateException {
  
  if ( log.isDebugEnabled() ) {
    EntityPersister persister = getFactory().getEntityPersister(entityName);
    log.debug( "initializing proxy: " + MessageHelper.infoString( persister, id, getFactory() ) );
  }
  
  LoadEvent event = new LoadEvent(id, entityName, true, this);
  Object result = listeners.getLoadEventListener().onLoad(event, LoadEventListener.IMMEDIATE_LOAD);
  ObjectNotFoundException.throwIfNull(result, id, entityName); //should it be UnresolvableObject?
  return result;
}
origin: hibernate/hibernate

public ScrollableResults scrollCustomQuery(CustomQuery customQuery, QueryParameters queryParameters) 
throws HibernateException {
  if ( log.isTraceEnabled() ) {
    log.trace( "scroll SQL query: " + customQuery.getSQL() );
  }
  CustomLoader loader = new CustomLoader( customQuery, getFactory() );
  autoFlushIfRequired( loader.getQuerySpaces() );
  dontFlushFromFind++; //stops flush being called multiple times if this method is recursively called
  try {
    return loader.scroll(queryParameters, this);
  }
  finally {
    dontFlushFromFind--;
  }
}
origin: hibernate/hibernate

public EntityPersister getEntityPersister(final String entityName, final Object object) {
  if (entityName==null) {
    return factory.getEntityPersister( guessEntityName(object) );
  }
  else {
    return factory.getEntityPersister( entityName ).getSubclassEntityPersister( object, getFactory(), entityMode );
  }
}
origin: hibernate/hibernate

public List listCustomQuery(CustomQuery customQuery, QueryParameters queryParameters) 
throws HibernateException {
  if ( log.isTraceEnabled() ) log.trace( "SQL query: " + customQuery.getSQL() );
  
  CustomLoader loader = new CustomLoader( customQuery, getFactory() );
  autoFlushIfRequired( loader.getQuerySpaces() );
  dontFlushFromFind++;
  boolean success = false;
  try {
    List results = loader.list(this, queryParameters);
    success = true;
    return results;
  }
  finally {
    dontFlushFromFind--;
    afterOperation(success);
  }
}
origin: hibernate/hibernate

public void forceFlush(EntityEntry e) throws HibernateException {
  if ( log.isDebugEnabled() ) {
    log.debug(
      "flushing to force deletion of re-saved object: " +
      MessageHelper.infoString( e.getPersister(), e.getId(), getFactory() )
    );
  }
  if ( persistenceContext.getCascadeLevel() > 0 ) {
    throw new ObjectDeletedException(
      "deleted object would be re-saved by cascade (remove deleted object from associations)",
      e.getId(),
      e.getPersister().getEntityName()
    );
  }
  flush();
}
origin: jboss.jboss-embeddable-ejb3/hibernate-all

public Object load(String entityName, Serializable id) throws HibernateException {
  LoadEvent event = new LoadEvent(id, entityName, false, this);
  boolean success = false;
  try {
    fireLoad( event, LoadEventListener.LOAD );
    if ( event.getResult() == null ) {
      getFactory().getEntityNotFoundDelegate().handleEntityNotFound( entityName, id );
    }
    success = true;
    return event.getResult();
  }
  finally {
    afterOperation(success);
  }
}
origin: hibernate/hibernate

final SessionFactoryImplementor factory = session.getFactory();
origin: jboss.jboss-embeddable-ejb3/hibernate-all

public EntityPersister getEntityPersister(final String entityName, final Object object) {
  errorIfClosed();
  if (entityName==null) {
    return factory.getEntityPersister( guessEntityName( object ) );
  }
  else {
    // try block is a hack around fact that currently tuplizers are not
    // given the opportunity to resolve a subclass entity name.  this
    // allows the (we assume custom) interceptor the ability to
    // influence this decision if we were not able to based on the
    // given entityName
    try {
      return factory.getEntityPersister( entityName )
          .getSubclassEntityPersister( object, getFactory(), entityMode );
    }
    catch( HibernateException e ) {
      try {
        return getEntityPersister( null, object );
      }
      catch( HibernateException e2 ) {
        throw e;
      }
    }
  }
}
org.hibernate.implSessionImplgetFactory

Popular methods of SessionImpl

  • <init>
    Constructor used in building "child sessions".
  • afterOperation
    Check if there is a Hibernate or JTA transaction in progress and, if there is not, flush if necessar
  • autoFlushIfRequired
    detect in-memory changes, determine if the changes are to tables named in the query and, if so, comp
  • cleanup
    clear all the internal collections, just to help the garbage collector, does not clear anything that
  • clear
  • close
  • delete
  • find
    Retrieve a list of persistent objects using a hibernate query
  • flush
  • get
  • getConnectionReleaseMode
  • getEnabledFilters
  • getConnectionReleaseMode,
  • getEnabledFilters,
  • getFlushMode,
  • getOuterJoinLoadable,
  • getProxyIdentifier,
  • guessEntityName,
  • isAutoCloseSessionEnabled,
  • iterate,
  • list

Popular in Java

  • Reactive rest calls using spring rest template
  • scheduleAtFixedRate (ScheduledExecutorService)
  • getResourceAsStream (ClassLoader)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • Time (java.sql)
    Java representation of an SQL TIME value. Provides utilities to format and parse the time's represen
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • HttpServlet (javax.servlet.http)
    Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A sub
  • JOptionPane (javax.swing)
  • Top plugins for Android Studio
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