本文整理汇总了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;
}
}
示例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;
}
示例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;
}
示例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() );
}
示例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 );
}
示例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;
}
}
示例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 );
}
}
}
示例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;
}
}
示例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 );
}
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
}
示例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;
}
示例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;
}