BasicCollectionPersister
Code IndexAdd Codota to your IDE (free)

Best Java code snippets using org.hibernate.persister.collection.BasicCollectionPersister (Showing top 20 results out of 315)

origin: hibernate/hibernate-orm

private String manyToManySelectFragment(
    Joinable rhs,
    String rhsAlias,
    String lhsAlias,
    String collectionSuffix) {
  SelectFragment frag = generateSelectFragment( lhsAlias, collectionSuffix );
  String[] elementColumnNames = rhs.getKeyColumnNames();
  frag.addColumns( rhsAlias, elementColumnNames, elementColumnAliases );
  appendIndexColumns( frag, lhsAlias );
  appendIdentifierColumns( frag, lhsAlias );
  return frag.toFragmentString()
      .substring( 2 ); //strip leading ','
}
origin: hibernate/hibernate-orm

@Override
protected CollectionInitializer createSubselectInitializer(SubselectFetch subselect, SharedSessionContractImplementor session) {
  return new SubselectCollectionLoader(
      this,
      subselect.toSubselectString( getCollectionType().getLHSPropertyName() ),
      subselect.getResult(),
      subselect.getQueryParameters(),
      subselect.getNamedParameterLocMap(),
      session.getFactory(),
      session.getLoadQueryInfluencers()
  );
}
origin: hibernate/hibernate-orm

public String selectFragment(
    Joinable rhs,
    String rhsAlias,
    String lhsAlias,
    String entitySuffix,
    String collectionSuffix,
    boolean includeCollectionColumns) {
  // we need to determine the best way to know that two joinables
  // represent a single many-to-many...
  if ( rhs != null && isManyToMany() && !rhs.isCollection() ) {
    AssociationType elementType = ( (AssociationType) getElementType() );
    if ( rhs.equals( elementType.getAssociatedJoinable( getFactory() ) ) ) {
      return manyToManySelectFragment( rhs, rhsAlias, lhsAlias, collectionSuffix );
    }
  }
  return includeCollectionColumns ? selectFragment( lhsAlias, collectionSuffix ) : "";
}
origin: hibernate/hibernate-orm

@SuppressWarnings({"unchecked", "UnusedParameters"})
protected Serializable snapshot(BasicCollectionPersister persister, EntityMode entityMode)
    throws HibernateException {
  final TreeMap clonedSet = new TreeMap( comparator );
  for ( Object setElement : set ) {
    final Object copy = persister.getElementType().deepCopy( setElement, persister.getFactory() );
    clonedSet.put( copy, copy );
  }
  return clonedSet;
}
origin: org.hibernate/com.springsource.org.hibernate.core

Expectation expectation = Expectations.appropriateExpectation( getUpdateCheckStyle() );
boolean callable = isUpdateCallable();
boolean useBatch = expectation.canBeBatched();
Iterator entries = collection.entries( this );
String sql = getSQLUpdateRowString();
int i = 0;
int count = 0;
      if ( updateBatchKey == null ) {
        updateBatchKey = new BasicBatchKey(
            getRole() + "#UPDATE",
            expectation
        );
      int loc = writeElement( st, collection.getElement( entry ), offset, session );
      if ( hasIdentifier ) {
        writeIdentifier( st, collection.getIdentifier( entry, i ), loc, session );
        loc = writeKey( st, id, loc, session );
        if ( hasIndex && !indexContainsFormula ) {
          writeIndexToWhere( st, collection.getIndex( entry, i, this ), loc, session );
          writeElementToWhere( st, collection.getSnapshotElement( entry, i ), loc, session );
throw getSQLExceptionHelper().convert(
    sqle,
    "could not update collection rows: " + MessageHelper.collectionInfoString( this, id, getFactory() ),
    getSQLUpdateRowString()
  );
origin: hibernate/hibernate

boolean callable = isUpdateCallable();
Iterator entries = collection.entries(this);
try {
        if ( callable ) {
          CallableStatement callstatement = session.getBatcher()
              .prepareBatchCallableStatement( getSQLUpdateRowString() );
          st = session.getBatcher().prepareBatchStatement( getSQLUpdateRowString() );
      int loc = writeElement(st, collection.getElement(entry), offset, session );
      if ( hasIdentifier ) {
        loc = writeIdentifier(st, collection.getIdentifier(entry, i), loc, session);
        loc = writeKey( st, id, loc, session );
        if ( hasIndex && !indexIsFormula ) {
          loc = writeIndexToWhere( st, collection.getIndex(entry, i, this), loc, session );
          loc = writeElementToWhere( st, collection.getSnapshotElement(entry, i), loc, session );
    getSQLExceptionConverter(),
    sqle,
    "could not update collection rows: " + MessageHelper.collectionInfoString( this, id, getFactory() ),
    getSQLUpdateRowString()
);
origin: hibernate/hibernate-orm

/**
 * Generate the SQL INSERT that creates a new row
 */
@Override
protected String generateInsertRowString() {
  final Insert insert = new Insert( getDialect() )
      .setTableName( qualifiedTableName )
      .addColumns( keyColumnNames );
  if ( hasIdentifier ) {
    insert.addColumn( identifierColumnName );
  }
  if ( hasIndex /*&& !indexIsFormula*/ ) {
    insert.addColumns( indexColumnNames, indexColumnIsSettable );
  }
  if ( getFactory().getSessionFactoryOptions().isCommentsEnabled() ) {
    insert.setComment( "insert collection row " + getRole() );
  }
  //if ( !elementIsFormula ) {
  insert.addColumns( elementColumnNames, elementColumnIsSettable, elementColumnWriters );
  //}
  return insert.toStatementString();
}
origin: hibernate/hibernate-orm

if ( updateBatchKey == null ) {
  updateBatchKey = new BasicBatchKey(
      getRole() + "#UPDATE",
      expectation
  );
int loc = writeElement( st, collection.getElement( entry ), offset, session );
if ( hasIdentifier ) {
  writeIdentifier( st, collection.getIdentifier( entry, i ), loc, session );
  loc = writeKey( st, id, loc, session );
  if ( hasIndex && !indexContainsFormula ) {
    writeIndexToWhere( st, collection.getIndex( entry, i, this ), loc, session );
    writeElementToWhere( st, collection.getSnapshotElement( entry, i ), loc, session );
origin: hibernate/hibernate-orm

/**
 * Generate the SQL DELETE that deletes all rows
 */
@Override
protected String generateDeleteString() {
  final Delete delete = new Delete()
      .setTableName( qualifiedTableName )
      .addPrimaryKeyColumns( keyColumnNames );
  if ( hasWhere ) {
    delete.setWhere( sqlWhereString );
  }
  if ( getFactory().getSessionFactoryOptions().isCommentsEnabled() ) {
    delete.setComment( "delete collection " + getRole() );
  }
  return delete.toStatementString();
}
origin: hibernate/hibernate-orm

final Expectation expectation = Expectations.appropriateExpectation( getUpdateCheckStyle() );
final boolean callable = isUpdateCallable();
final int jdbcBatchSizeToUse = session.getConfiguredJdbcBatchSize();
boolean useBatch = expectation.canBeBatched() && jdbcBatchSizeToUse > 1;
final String sql = getSQLUpdateRowString();
int count = 0;
if ( collection.isElementRemoved() ) {
    count = doUpdateRow(
        id,
        collection,
    count = doUpdateRow(
        id,
        collection,
        session
    ),
    getSQLUpdateRowString()
);
origin: hibernate/hibernate-orm

/**
 * Create the <tt>CollectionLoader</tt>
 *
 * @see org.hibernate.loader.collection.BasicCollectionLoader
 */
@Override
protected CollectionInitializer createCollectionInitializer(LoadQueryInfluencers loadQueryInfluencers)
    throws MappingException {
  return BatchingCollectionInitializerBuilder.getBuilder( getFactory() )
      .createBatchingCollectionInitializer( this, batchSize, getFactory(), loadQueryInfluencers );
}
origin: org.hibernate/com.springsource.org.hibernate

Expectation expectation = Expectations.appropriateExpectation( getUpdateCheckStyle() );
boolean callable = isUpdateCallable();
boolean useBatch = expectation.canBeBatched();
Iterator entries = collection.entries( this );
String sql = getSQLUpdateRowString();
int i = 0;
int count = 0;
      if ( updateBatchKey == null ) {
        updateBatchKey = new BasicBatchKey(
            getRole() + "#UPDATE",
            expectation
        );
      int loc = writeElement( st, collection.getElement( entry ), offset, session );
      if ( hasIdentifier ) {
        writeIdentifier( st, collection.getIdentifier( entry, i ), loc, session );
        loc = writeKey( st, id, loc, session );
        if ( hasIndex && !indexContainsFormula ) {
          writeIndexToWhere( st, collection.getIndex( entry, i, this ), loc, session );
          writeElementToWhere( st, collection.getSnapshotElement( entry, i ), loc, session );
throw getSQLExceptionHelper().convert(
    sqle,
    "could not update collection rows: " + MessageHelper.collectionInfoString( this, id, getFactory() ),
    getSQLUpdateRowString()
  );
origin: jboss.jboss-embeddable-ejb3/hibernate-all

PreparedStatement st = null;
Expectation expectation = Expectations.appropriateExpectation( getUpdateCheckStyle() );
boolean callable = isUpdateCallable();
boolean useBatch = expectation.canBeBatched();
Iterator entries = collection.entries( this );
String sql = getSQLUpdateRowString();
int i = 0;
int count = 0;
      int loc = writeElement( st, collection.getElement( entry ), offset, session );
      if ( hasIdentifier ) {
        writeIdentifier( st, collection.getIdentifier( entry, i ), loc, session );
        loc = writeKey( st, id, loc, session );
        if ( hasIndex && !indexContainsFormula ) {
          writeIndexToWhere( st, collection.getIndex( entry, i, this ), loc, session );
          writeElementToWhere( st, collection.getSnapshotElement( entry, i ), loc, session );
    getSQLExceptionConverter(),
    sqle,
    "could not update collection rows: " + MessageHelper.collectionInfoString( this, id, getFactory() ),
    getSQLUpdateRowString()
  );
origin: hibernate/hibernate-orm

/**
 * Generate the SQL UPDATE that updates a row
 */
@Override
protected String generateUpdateRowString() {
  final Update update = new Update( getDialect() )
      .setTableName( qualifiedTableName );
  //if ( !elementIsFormula ) {
  update.addColumns( elementColumnNames, elementColumnIsSettable, elementColumnWriters );
  //}
  if ( hasIdentifier ) {
    update.addPrimaryKeyColumns( new String[] {identifierColumnName} );
  }
  else if ( hasIndex && !indexContainsFormula ) {
    update.addPrimaryKeyColumns( ArrayHelper.join( keyColumnNames, indexColumnNames ) );
  }
  else {
    update.addPrimaryKeyColumns( keyColumnNames );
    update.addPrimaryKeyColumns( elementColumnNames, elementColumnIsInPrimaryKey, elementColumnWriters );
  }
  if ( getFactory().getSessionFactoryOptions().isCommentsEnabled() ) {
    update.setComment( "update collection row " + getRole() );
  }
  return update.toStatementString();
}
origin: hibernate/hibernate-orm

/**
 * Generate the SQL DELETE that deletes a particular row
 */
@Override
protected String generateDeleteRowString() {
  final Delete delete = new Delete().setTableName( qualifiedTableName );
  if ( hasIdentifier ) {
    delete.addPrimaryKeyColumns( new String[] {identifierColumnName} );
  }
  else if ( hasIndex && !indexContainsFormula ) {
    delete.addPrimaryKeyColumns( ArrayHelper.join( keyColumnNames, indexColumnNames ) );
  }
  else {
    delete.addPrimaryKeyColumns( keyColumnNames );
    delete.addPrimaryKeyColumns( elementColumnNames, elementColumnIsInPrimaryKey, elementColumnWriters );
  }
  if ( getFactory().getSessionFactoryOptions().isCommentsEnabled() ) {
    delete.setComment( "delete collection row " + getRole() );
  }
  return delete.toStatementString();
}
origin: hibernate/hibernate-orm

@SuppressWarnings({"unchecked", "UnusedParameters"})
protected Serializable snapshot(BasicCollectionPersister persister, EntityMode entityMode) throws HibernateException {
  final TreeMap clonedMap = new TreeMap( comparator );
  for ( Object o : map.entrySet() ) {
    final Entry e = (Entry) o;
    clonedMap.put( e.getKey(), persister.getElementType().deepCopy( e.getValue(), persister.getFactory() ) );
  }
  return clonedMap;
}
origin: org.hibernate/com.springsource.org.hibernate

/**
 * Create the <tt>CollectionLoader</tt>
 *
 * @see org.hibernate.loader.collection.BasicCollectionLoader
 */
@Override
protected CollectionInitializer createCollectionInitializer(LoadQueryInfluencers loadQueryInfluencers)
    throws MappingException {
  return BatchingCollectionInitializer.createBatchingCollectionInitializer( this, batchSize, getFactory(), loadQueryInfluencers );
}
origin: hibernate/hibernate

public String selectFragment(
    Joinable rhs,
    String rhsAlias,
    String lhsAlias,
    String entitySuffix,
    String collectionSuffix,
    boolean includeCollectionColumns) {
  // we need to determine the best way to know that two joinables
  // represent a single many-to-many...
  if ( rhs != null && isManyToMany() && !rhs.isCollection() ) {
    AssociationType elementType = ( ( AssociationType ) getElementType() );
    if ( rhs.equals( elementType.getAssociatedJoinable( getFactory() ) ) ) {
      return manyToManySelectFragment( rhs, rhsAlias, lhsAlias, collectionSuffix );
    }
  }
  return includeCollectionColumns ? selectFragment( lhsAlias, collectionSuffix ) : "";
}
origin: org.hibernate/com.springsource.org.hibernate

/**
 * Generate the SQL INSERT that creates a new row
 */
@Override
protected String generateInsertRowString() {
  
  Insert insert = new Insert( getDialect() )
      .setTableName( qualifiedTableName )
      .addColumns( keyColumnNames );
  
  if ( hasIdentifier) insert.addColumn( identifierColumnName );
  
  if ( hasIndex /*&& !indexIsFormula*/ ) {
    insert.addColumns( indexColumnNames, indexColumnIsSettable );
  }
  
  if ( getFactory().getSettings().isCommentsEnabled() ) {
    insert.setComment( "insert collection row " + getRole() );
  }
  
  //if ( !elementIsFormula ) {
    insert.addColumns( elementColumnNames, elementColumnIsSettable, elementColumnWriters );
  //}
  
  return insert.toStatementString();
}
origin: hibernate/hibernate

/**
 * Generate the SQL DELETE that deletes all rows
 */
protected String generateDeleteString() {
  
  Delete delete = new Delete()
      .setTableName( qualifiedTableName )
      .setPrimaryKeyColumnNames( keyColumnNames );
  
  if ( hasWhere ) delete.setWhere( sqlWhereString );
  
  if ( getFactory().getSettings().isCommentsEnabled() ) {
    delete.setComment( "delete collection " + getRole() );
  }
  
  return delete.toStatementString();
}
org.hibernate.persister.collectionBasicCollectionPersister

Javadoc

Collection persister for collections of values and many-to-many associations.

Most used methods

  • appendIdentifierColumns
  • appendIndexColumns
  • generateSelectFragment
  • getCollectionType
  • getElementType
  • getFactory
  • getRole
  • getSQLUpdateRowString
  • isManyToMany
  • isUpdateCallable
  • manyToManySelectFragment
  • selectFragment
  • manyToManySelectFragment,
  • selectFragment,
  • writeElement,
  • writeElementToWhere,
  • writeIdentifier,
  • writeIndexToWhere,
  • writeKey,
  • getDialect,
  • getUpdateCheckStyle,
  • <init>

Popular in Java

  • Running tasks concurrently on multiple threads
  • getSharedPreferences (Context)
  • getApplicationContext (Context)
  • findViewById (Activity)
  • BufferedReader (java.io)
    Wraps an existing Reader and buffers the input. Expensive interaction with the underlying reader is
  • FileReader (java.io)
    A specialized Reader that reads from a file in the file system. All read requests made by calling me
  • TimeUnit (java.util.concurrent)
    A TimeUnit represents time durations at a given unit of granularity and provides utility methods to
  • BoxLayout (javax.swing)
  • JList (javax.swing)
  • SAXParseException (org.xml.sax)
    Encapsulate an XML parse error or warning.> This module, both source code and documentation, is in t

For IntelliJ IDEA,
Android Studio or Eclipse

  • Search for JavaScript code betaCodota IntelliJ IDEA pluginCodota Android Studio pluginCode IndexSign in
  • EnterpriseFAQAboutBlogContact Us
  • Plugin user guideTerms of usePrivacy policyCodeboxFind Usages
Add Codota to your IDE (free)