org.hibernate.Hibernate.entity()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(2.0k)|赞(0)|评价(0)|浏览(210)

本文整理了Java中org.hibernate.Hibernate.entity()方法的一些代码示例,展示了Hibernate.entity()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Hibernate.entity()方法的具体详情如下:
包路径:org.hibernate.Hibernate
类名称:Hibernate
方法名:entity

Hibernate.entity介绍

[英]A Hibernate persistent object (entity) type.
[中]休眠持久对象(实体)类型。

代码示例

代码示例来源:origin: hibernate/hibernate

public Query setEntity(int position, Object val) {
  setParameter( position, val, Hibernate.entity( session.bestGuessEntityName(val) ) );
  return this;
}

代码示例来源:origin: hibernate/hibernate

public Query setEntity(String name, Object val) {
  setParameter( name, val, Hibernate.entity( session.bestGuessEntityName(val) ) );
  return this;
}

代码示例来源:origin: hibernate/hibernate

public String toLoggableString(Object value, SessionFactoryImplementor factory) 
throws HibernateException {
  //TODO: terrible implementation!
  return value==null ?
    "null" :
    Hibernate.entity( HibernateProxyHelper.getClassWithoutInitializingProxy(value) )
        .toLoggableString(value, factory);
}

代码示例来源:origin: jboss.jboss-embeddable-ejb3/hibernate-all

public String toLoggableString(Object value, SessionFactoryImplementor factory) 
throws HibernateException {
  //TODO: terrible implementation!
  return value==null ?
      "null" :
      Hibernate.entity( HibernateProxyHelper.getClassWithoutInitializingProxy(value) )
          .toLoggableString(value, factory);
}

代码示例来源:origin: hibernate/hibernate

private Type guessType(Class clazz) throws HibernateException {
  String typename = clazz.getName();
  Type type = TypeFactory.heuristicType(typename);
  boolean serializable = type!=null && type instanceof SerializableType;
  if (type==null || serializable) {
    try {
      session.getFactory().getEntityPersister( clazz.getName() );
    }
    catch (MappingException me) {
      if (serializable) {
        return type;
      }
      else {
        throw new HibernateException("Could not determine a type for class: " + typename);
      }
    }
    return Hibernate.entity(clazz);
  }
  else {
    return type;
  }
}

代码示例来源:origin: hibernate/hibernate

type = Hibernate.entity( typeClass );

代码示例来源:origin: jboss.jboss-embeddable-ejb3/hibernate-all

type = Hibernate.entity( typeClass );

相关文章