當前位置: 首頁>>代碼示例>>Java>>正文


Java Hibernate.isInitialized方法代碼示例

本文整理匯總了Java中org.hibernate.Hibernate.isInitialized方法的典型用法代碼示例。如果您正苦於以下問題:Java Hibernate.isInitialized方法的具體用法?Java Hibernate.isInitialized怎麽用?Java Hibernate.isInitialized使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.hibernate.Hibernate的用法示例。


在下文中一共展示了Hibernate.isInitialized方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: reassociateIfUninitializedProxy

import org.hibernate.Hibernate; //導入方法依賴的package包/類
@Override
public boolean reassociateIfUninitializedProxy(Object value) throws MappingException {
	if ( value instanceof ElementWrapper ) {
		value = ( (ElementWrapper) value ).getElement();
	}

	if ( !Hibernate.isInitialized( value ) ) {
		final HibernateProxy proxy = (HibernateProxy) value;
		final LazyInitializer li = proxy.getHibernateLazyInitializer();
		reassociateProxy( li, proxy );
		return true;
	}
	else {
		return false;
	}
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:17,代碼來源:StatefulPersistenceContext.java

示例2: getHomeMunicipalityName

import org.hibernate.Hibernate; //導入方法依賴的package包/類
@Nonnull
public LocalisedString getHomeMunicipalityName() {
    if (this.homeMunicipality != null) {
        if (!Hibernate.isInitialized(this.homeMunicipality)) {
            try {
                // Referenced row might not exist
                return this.homeMunicipality.getNameLocalisation();
            } catch (UnresolvableObjectException | EntityNotFoundException o) {
                this.homeMunicipality = null;
            }
        } else {
            return this.homeMunicipality.getNameLocalisation();
        }
    }
    return LocalisedString.EMPTY;
}
 
開發者ID:suomenriistakeskus,項目名稱:oma-riista-web,代碼行數:17,代碼來源:Person.java

示例3: writeObject

import org.hibernate.Hibernate; //導入方法依賴的package包/類
@Override
public void writeObject(Object obj, AbstractHessianOutput out) throws IOException {
    boolean init = Hibernate.isInitialized(obj);

    out.writeObject(init ? obj : null);
    out.flush();
    return;
}
 
開發者ID:mmdsyl,項目名稱:BLOG-Microservice,代碼行數:9,代碼來源:HibernateSerializerFactory.java

示例4: isReachable

import org.hibernate.Hibernate; //導入方法依賴的package包/類
public boolean isReachable(Object traversableObject,
						   Path.Node traversableProperty,
						   Class<?> rootBeanType,
						   Path pathToTraversableObject,
						   ElementType elementType) {
	//lazy, don't load
	return Hibernate.isInitialized( traversableObject )
			&& Hibernate.isPropertyInitialized( traversableObject, traversableProperty.getName() );
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:10,代碼來源:HibernateTraversableResolver.java

示例5: isFoundInParent

import org.hibernate.Hibernate; //導入方法依賴的package包/類
private boolean isFoundInParent(
		String property,
		Object childEntity,
		EntityPersister persister,
		CollectionPersister collectionPersister,
		Object potentialParent) {
	final Object collection = persister.getPropertyValue( potentialParent, property );
	return collection != null
			&& Hibernate.isInitialized( collection )
			&& collectionPersister.getCollectionType().contains( collection, childEntity, session );
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:12,代碼來源:StatefulPersistenceContext.java

示例6: getIndexInParent

import org.hibernate.Hibernate; //導入方法依賴的package包/類
private Object getIndexInParent(
		String property,
		Object childEntity,
		EntityPersister persister,
		CollectionPersister collectionPersister,
		Object potentialParent){
	final Object collection = persister.getPropertyValue( potentialParent, property );
	if ( collection != null && Hibernate.isInitialized( collection ) ) {
		return collectionPersister.getCollectionType().indexOf( collection, childEntity );
	}
	else {
		return null;
	}
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:15,代碼來源:StatefulPersistenceContext.java

示例7: setReadOnly

import org.hibernate.Hibernate; //導入方法依賴的package包/類
@Override
public void setReadOnly(Object object, boolean readOnly) {
	if ( object == null ) {
		throw new AssertionFailure( "object must be non-null." );
	}
	if ( isReadOnly( object ) == readOnly ) {
		return;
	}
	if ( object instanceof HibernateProxy ) {
		final HibernateProxy proxy = (HibernateProxy) object;
		setProxyReadOnly( proxy, readOnly );
		if ( Hibernate.isInitialized( proxy ) ) {
			setEntityReadOnly(
					proxy.getHibernateLazyInitializer().getImplementation(),
					readOnly
			);
		}
	}
	else {
		setEntityReadOnly( object, readOnly );
		// PersistenceContext.proxyFor( entity ) returns entity if there is no proxy for that entity
		// so need to check the return value to be sure it is really a proxy
		final Object maybeProxy = getSession().getPersistenceContext().proxyFor( object );
		if ( maybeProxy instanceof HibernateProxy ) {
			setProxyReadOnly( (HibernateProxy) maybeProxy, readOnly );
		}
	}
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:29,代碼來源:StatefulPersistenceContext.java

示例8: reassociateIfUninitializedProxy

import org.hibernate.Hibernate; //導入方法依賴的package包/類
protected boolean reassociateIfUninitializedProxy(Object object, SessionImplementor source) {
	if ( !Hibernate.isInitialized(object) ) {
		throw new PersistentObjectException("uninitialized proxy passed to save()");
	}
	else {
		return false;
	}
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:9,代碼來源:DefaultSaveEventListener.java

示例9: toLoggableString

import org.hibernate.Hibernate; //導入方法依賴的package包/類
@Override
public String toLoggableString(Object value, SessionFactoryImplementor factory)
		throws HibernateException {
	if ( value == null ) {
		return "null";
	}
	else if ( !Hibernate.isInitialized( value ) ) {
		return "<uninitialized>";
	}
	else {
		return renderLoggableString( value, factory );
	}
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:14,代碼來源:CollectionType.java

示例10: replace

import org.hibernate.Hibernate; //導入方法依賴的package包/類
@Override
public Object replace(
		final Object original,
		final Object target,
		final SessionImplementor session,
		final Object owner,
		final Map copyCache) throws HibernateException {
	if ( original == null ) {
		return null;
	}
	if ( !Hibernate.isInitialized( original ) ) {
		return target;
	}

	// for a null target, or a target which is the same as the original, we
	// need to put the merged elements in a new collection
	Object result = target == null || target == original ? instantiateResult( original ) : target;
	
	//for arrays, replaceElements() may return a different reference, since
	//the array length might not match
	result = replaceElements( original, result, owner, copyCache, session );

	if ( original == target ) {
		// get the elements back into the target making sure to handle dirty flag
		boolean wasClean = PersistentCollection.class.isInstance( target ) && !( ( PersistentCollection ) target ).isDirty();
		//TODO: this is a little inefficient, don't need to do a whole
		//      deep replaceElements() call
		replaceElements( result, target, owner, copyCache, session );
		if ( wasClean ) {
			( ( PersistentCollection ) target ).clearDirty();
		}
		result = target;
	}

	return result;
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:37,代碼來源:CollectionType.java

示例11: appliesTo

import org.hibernate.Hibernate; //導入方法依賴的package包/類
/**
 * @param aClass
 * @return
 */
public boolean appliesTo(Class_ aClass) {
	if (this.getDistributionObjects()==null) return false;
	Iterator it = null;
	try {
		it = getDistributionObjects().iterator();
	} catch (ObjectNotFoundException e) {
		Debug.error("Exception "+e.getMessage()+" seen for "+this);
   		new _RootDAO().getSession().refresh(this);
  			it = getDistributionObjects().iterator();
	}
	while (it.hasNext()) {
		DistributionObject dObj = (DistributionObject) it.next();
		
		//Class_ check
		//no checking whether dObj.getPrefGroup() is Class_ not needed since all PreferenceGroups have unique ids
		if (dObj.getPrefGroup().getUniqueId().equals(aClass.getUniqueId())) return true;
		
		//SchedulingSubpart check
		SchedulingSubpart ss = null;
		if (Hibernate.isInitialized(dObj.getPrefGroup())) {
			if (dObj.getPrefGroup() instanceof SchedulingSubpart) {
				ss = (SchedulingSubpart) dObj.getPrefGroup();
			}
		} else {
			//dObj.getPrefGroup() is a proxy -> try to load it
			PreferenceGroup pg = (new PreferenceGroupDAO()).get(dObj.getPrefGroup().getUniqueId());
			if (pg!=null && pg instanceof SchedulingSubpart)
				ss = (SchedulingSubpart)pg;
		}
		if (ss!=null && ss.getClasses()!=null && ss.getClasses().size()>0) {
			for (Iterator it2 = ss.getClasses().iterator();it2.hasNext();)
				if (((Class_)it2.next()).getUniqueId().equals(aClass.getUniqueId())) return true;
		}
	}
	return false;
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:41,代碼來源:DistributionPref.java

示例12: getDatePattern

import org.hibernate.Hibernate; //導入方法依賴的package包/類
public DatePattern getDatePattern() {
	DatePattern dp = super.getDatePattern();
	if (dp != null && !Hibernate.isInitialized(dp.getSession()))
		return (DatePattern)AssignmentDAO.getInstance().getSession().merge(dp);
	if (dp == null && getClazz() != null)
		dp = getClazz().effectiveDatePattern();
	return dp;
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:9,代碼來源:Assignment.java

示例13: getHtmlHint

import org.hibernate.Hibernate; //導入方法依賴的package包/類
@Deprecated
  public String getHtmlHint(String preference) {
try {
	if (!Hibernate.isPropertyInitialized(this, "roomType") || !Hibernate.isInitialized(getRoomType())) {
		return LocationDAO.getInstance().get(getUniqueId()).getHtmlHintImpl(preference);
	} else {
		return getHtmlHintImpl(preference);
	}
} catch (LazyInitializationException e) {
	return LocationDAO.getInstance().get(getUniqueId()).getHtmlHintImpl(preference);
}
  }
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:13,代碼來源:Location.java

示例14: loadInitialize

import org.hibernate.Hibernate; //導入方法依賴的package包/類
public cn.com.chinaebi.dz.object.ErrorTkLst loadInitialize(java.lang.String key, Session s) 
{ 
	cn.com.chinaebi.dz.object.ErrorTkLst obj = load(key, s); 
	if (!Hibernate.isInitialized(obj)) {
		Hibernate.initialize(obj);
	} 
	return obj; 
}
 
開發者ID:wufeisoft,項目名稱:data,代碼行數:9,代碼來源:BaseErrorTkLstDAO.java

示例15: loadInitialize

import org.hibernate.Hibernate; //導入方法依賴的package包/類
public cn.com.chinaebi.dz.object.CustomObject loadInitialize(java.lang.Integer key, Session s) 
{ 
	cn.com.chinaebi.dz.object.CustomObject obj = load(key, s); 
	if (!Hibernate.isInitialized(obj)) {
		Hibernate.initialize(obj);
	} 
	return obj; 
}
 
開發者ID:wufeisoft,項目名稱:data,代碼行數:9,代碼來源:BaseCustomObjectDAO.java


注:本文中的org.hibernate.Hibernate.isInitialized方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。