public boolean isDirty(Object old, Object current, boolean[] checkable, SessionImplementor session) throws HibernateException { return checkable[0] ? ! isEqual( old, current, session.getEntityMode() ) : false; }
public Object replace( Object original, Object target, SessionImplementor session, Object owner, Map copyCache ) throws HibernateException { if ( isEqual( original, target, session.getEntityMode() ) ) return original; return deepCopy( original, session.getEntityMode(), session.getFactory() ); }
public Query setParameter(String name, Object val, Type type) { if( !actualNamedParameters.contains(name) ) { throw new IllegalArgumentException("Parameter " + name + " does not exist as a named parameter in [" + getQueryString() + "]"); } else { namedParameters.put( name, new TypedValue( type, val, session.getEntityMode() ) ); return this; } }
public Object replace( Object original, Object target, SessionImplementor session, Object owner, Map copyCache) throws HibernateException { if ( isEqual( original, target, session.getEntityMode() ) ) return original; return deepCopy( original, session.getEntityMode(), session.getFactory() ); }
protected Serializable snapshot(CollectionPersister persister) throws HibernateException { EntityMode entityMode = getSession().getEntityMode(); ArrayList clonedList = new ArrayList( bag.size() ); Iterator iter = bag.iterator(); while ( iter.hasNext() ) { clonedList.add( persister.getElementType().deepCopy( iter.next(), entityMode, persister.getFactory() ) ); } return clonedList; }
public PersistentCollection instantiate(SessionImplementor session, CollectionPersister persister, Serializable key) { if ( session.getEntityMode()==EntityMode.DOM4J ) { return new PersistentListElementHolder(session, persister, key); } else { return new PersistentList(session); } }
public PersistentCollection wrap(SessionImplementor session, Object collection) { if ( session.getEntityMode()==EntityMode.DOM4J ) { return new PersistentElementHolder( session, (Element) collection ); } else { return new PersistentSortedSet( session, (java.util.SortedSet) collection ); } } }
public PersistentCollection wrap(SessionImplementor session, Object collection) { if ( session.getEntityMode()==EntityMode.DOM4J ) { return new PersistentElementHolder( session, (Element) collection ); } else { return new PersistentSet( session, (java.util.Set) collection ); } }
public PersistentCollection wrap(SessionImplementor session, Object collection) { if ( session.getEntityMode()==EntityMode.DOM4J ) { return new PersistentElementHolder( session, (Element) collection ); } else { return new PersistentSet( session, (java.util.Set) collection ); } }
public PersistentCollection wrap(SessionImplementor session, Object collection) { if ( session.getEntityMode()==EntityMode.DOM4J ) { return new PersistentElementHolder( session, (Element) collection ); } else { return new PersistentSortedMap( session, (java.util.SortedMap) collection ); } }
public PersistentCollection wrap(SessionImplementor session, Object collection) { if ( session.getEntityMode()==EntityMode.DOM4J ) { return new PersistentListElementHolder( session, (Element) collection ); } else { return new PersistentList( session, (List) collection ); } }
public PersistentCollection wrap(SessionImplementor session, Object collection) { if ( session.getEntityMode()==EntityMode.DOM4J ) { return new PersistentMapElementHolder( session, (Element) collection ); } else { return new PersistentMap( session, (java.util.Map) collection ); } }
public Serializable getSnapshot(CollectionPersister persister) throws HibernateException { EntityMode entityMode = getSession().getEntityMode(); HashMap clonedMap = new HashMap( map.size() ); Iterator iter = map.entrySet().iterator(); while ( iter.hasNext() ) { Map.Entry e = (Map.Entry) iter.next(); final Object copy = persister.getElementType() .deepCopy( e.getValue(), entityMode, persister.getFactory() ); clonedMap.put( e.getKey(), copy ); } return clonedMap; }
public boolean isDirty(Object old, Object current, SessionImplementor session) throws HibernateException { if ( isSame( old, current, session.getEntityMode() ) ) return false; Object oldid = getIdentifier(old, session); Object newid = getIdentifier(current, session); return !getIdentifierType(session).isSame( oldid, newid, session.getEntityMode() ); }
public Serializable generate(SessionImplementor session, Object obj) throws HibernateException { if (obj instanceof PersistentCollection) throw new IdentifierGenerationException( "Illegal use of assigned id generation for a toplevel collection" ); final Serializable id = session.getEntityPersister( entityName, obj ).getIdentifier( obj, session.getEntityMode() ); if (id==null) throw new IdentifierGenerationException( "ids for this class must be manually assigned before calling save(): " + obj.getClass().getName() ); return id; }
/** * Get the entity that owns this persistent collection */ public Object getCollectionOwner(Serializable key, CollectionPersister collectionPersister) throws MappingException { return getEntity( new EntityKey( key, collectionPersister.getOwnerEntityPersister(), session.getEntityMode() ) ); }
public Serializable generate(SessionImplementor session, Object obj) throws HibernateException { final Serializable id = session.getEntityPersister( entityName, obj ) //TODO: cache the persister, this shows up in yourkit .getIdentifier( obj, session.getEntityMode() ); if (id==null) { throw new IdentifierGenerationException( "ids for this class must be manually assigned before calling save(): " + entityName ); } return id; }
protected void bindParameters(SessionImplementor session, PreparedStatement ps, Object object, PostInsertIdentityPersister persister) throws SQLException { Type uniqueKeyPropertyType = session.getSessionFactory() .getClassMetadata(entityName) .getPropertyType(uniqueKeyPropertyName); Object uniqueKeyValue = persister.getPropertyValue( object, uniqueKeyPropertyName, session.getEntityMode() ); uniqueKeyPropertyType.nullSafeSet( ps, uniqueKeyValue, 1, session ); }
public final void beforeExecutions() throws CacheException { // we need to obtain the lock before any actions are // executed, since this may be an inverse="true" // bidirectional association and it is one of the // earlier entity actions which actually updates // the database (this action is resposible for // second-level cache invalidation only) final CacheKey ck = new CacheKey( key, persister.getKeyType(), persister.getRole(), session.getEntityMode(), session.getFactory() ); if ( persister.hasCache() ) lock = persister.getCache().lock(ck, null); }
private static void processNeverReferencedCollection(PersistentCollection coll, SessionImplementor session) throws HibernateException { final PersistenceContext persistenceContext = session.getPersistenceContext(); CollectionEntry entry = persistenceContext.getCollectionEntry(coll); log.debug( "Found collection with unloaded owner: " + MessageHelper.collectionInfoString( entry.getLoadedPersister(), entry.getLoadedKey(), session.getFactory() ) ); entry.setCurrentPersister( entry.getLoadedPersister() ); entry.setCurrentKey( entry.getLoadedKey() ); prepareCollectionForUpdate( coll, entry, session.getEntityMode(), session.getFactory() ); }