下面列出了怎么用org.hibernate.type.IntegerType的API类实例代码及写法,或者点击链接到github查看源代码。
@SuppressWarnings("unchecked")
@Override
public Object[] getStatsMarksForLeaders(Long toolContentId) {
NativeQuery<Object[]> query = getSession().createNativeQuery(FIND_MARK_STATS_FOR_LEADERS)
.addScalar("min_grade", FloatType.INSTANCE)
.addScalar("avg_grade", FloatType.INSTANCE)
.addScalar("max_grade", FloatType.INSTANCE)
.addScalar("num_complete", IntegerType.INSTANCE);
query.setParameter("toolContentId", toolContentId);
List list = query.list();
if ((list == null) || (list.size() == 0)) {
return null;
} else {
return (Object[]) list.get(0);
}
}
@SuppressWarnings("rawtypes")
@Override
public Object[] getStatsMarksForLeaders(Long toolContentId) {
Query<?> query = getSession().createSQLQuery(FIND_MARK_STATS_FOR_LEADERS)
.addScalar("min_grade", FloatType.INSTANCE)
.addScalar("avg_grade", FloatType.INSTANCE)
.addScalar("max_grade", FloatType.INSTANCE)
.addScalar("num_complete", IntegerType.INSTANCE);
query.setParameter("toolContentId", toolContentId);
List<?> list = query.list();
if ((list == null) || (list.size() == 0)) {
return null;
} else {
return (Object[]) list.get(0);
}
}
@Override
public Object[] getStatsMarksForLeaders(Long toolContentId) {
NativeQuery<?> query = getSession().createNativeQuery(FIND_MARK_STATS)
.addScalar("min_grade", FloatType.INSTANCE)
.addScalar("avg_grade", FloatType.INSTANCE)
.addScalar("max_grade", FloatType.INSTANCE)
.addScalar("num_complete", IntegerType.INSTANCE);
query.setParameter("toolContentId", toolContentId);
@SuppressWarnings("unchecked")
List<Object[]> list = (List<Object[]>) query.list();
if ((list == null) || (list.size() == 0)) {
return null;
} else {
return (Object[]) list.get(0);
}
}
@SuppressWarnings({ "unchecked" })
private SortedSet<Comment> getNextThreadByThreadIdNewestFirst(final Long rootTopicId,
final Long previousThreadMessageId, Integer numberOfThreads, Integer sortBy, Integer userId) {
// the search to get to the top level is quite light, so get just the uids
// then build a complete set.
List<Number> threadUidList = null;
if (previousThreadMessageId == null || previousThreadMessageId == 0L) {
threadUidList = getSession().createSQLQuery(SQL_QUERY_FIND_FIRST_THREAD_TOP_BY_UID)
.setParameter("rootUid", rootTopicId).setMaxResults(numberOfThreads).list();
} else {
threadUidList = getSession().createSQLQuery(SQL_QUERY_FIND_NEXT_THREAD_TOP).setParameter("rootUid", rootTopicId)
.setParameter("lastUid", previousThreadMessageId).setMaxResults(numberOfThreads).list();
}
if (threadUidList != null && threadUidList.size() > 0) {
NativeQuery<Object[]> query = getSession().createNativeQuery(SQL_QUERY_FIND_NEXT_THREAD_MESSAGES);
query.addEntity("comment", Comment.class).addScalar("likes_total", IntegerType.INSTANCE)
.addScalar("user_vote", IntegerType.INSTANCE).setParameter("userId", userId != null ? userId : 0)
.setParameterList("threadIds", threadUidList);
List<Object[]> results = query.list();
return upgradeComments(results, sortBy);
}
return new TreeSet<Comment>();
}
@SuppressWarnings({ "unchecked" })
private SortedSet<Comment> getStickyByThreadIdNewestFirst(final Long rootTopicId, Integer sortBy, Integer userId) {
// the search to get to the top level is quite light, so get just the uids
// then build a complete set.
List<Number> threadUidList = getSession().createNativeQuery(SQL_QUERY_FIND_STICKY_BY_UID)
.setParameter("rootUid", rootTopicId).list();
if (threadUidList != null && threadUidList.size() > 0) {
NativeQuery<Object[]> query = getSession().createSQLQuery(SQL_QUERY_FIND_NEXT_THREAD_MESSAGES);
query.addEntity("comment", Comment.class).addScalar("likes_total", IntegerType.INSTANCE)
.addScalar("user_vote", IntegerType.INSTANCE).setParameter("userId", userId != null ? userId : 0)
.setParameterList("threadIds", threadUidList);
List<Object[]> results = query.list();
return upgradeComments(results, sortBy);
}
return new TreeSet<Comment>();
}
@SuppressWarnings({ "unchecked" })
private SortedSet<Comment> getStickyByThreadIdLikes(final Long rootTopicId, Integer sortBy, String extraSortParam,
Integer userId) {
List<Object[]> topThreadObjects = getSession().createNativeQuery(SQL_QUERY_FIND_STICKY_BY_LIKES)
.addEntity("comment", Comment.class).addScalar("likes_total", IntegerType.INSTANCE)
.addScalar("user_vote", IntegerType.INSTANCE).setParameter("rootUid", rootTopicId)
.setParameter("userId", userId != null ? userId : 0).list();
if (topThreadObjects != null && topThreadObjects.size() > 0) {
// build the list of uids
List<Number> threadUidList = new ArrayList<Number>();
for (Object[] rawObject : topThreadObjects) {
Comment comment = (Comment) rawObject[0];
threadUidList.add(comment.getUid());
}
NativeQuery<Object[]> query = getSession().createNativeQuery(SQL_QUERY_FIND_NEXT_THREAD_MESSAGES_REPLIES_ONLY);
query.addEntity("comment", Comment.class).addScalar("likes_total", IntegerType.INSTANCE)
.addScalar("user_vote", IntegerType.INSTANCE).setParameter("userId", userId != null ? userId : 0)
.setParameterList("threadIds", threadUidList);
List<Object[]> results = query.list();
topThreadObjects.addAll(results);
return upgradeComments(topThreadObjects, sortBy);
}
return new TreeSet<Comment>();
}
/**
* Tests, whether a page with the given pageID exists.
* Trying to retrieve a pageID that does not exist in Wikipedia throws an exception.
*
* @param pageID A pageID.
* @return {@code True}, if a page with that pageID exits, {@code false} otherwise.
*/
public boolean existsPage(int pageID) {
// This is a hack to provide a much quicker way to test whether a page exists.
// Encoding the title in this way surpasses the normal way of creating a title first.
// Anyway, I do not like this hack :-|
if (pageID < 0) {
return false;
}
Session session = this.__getHibernateSession();
session.beginTransaction();
List returnList = session.createNativeQuery(
"select p.id from PageMapLine as p where p.pageID = :pageId")
.setParameter("pageId", pageID, IntegerType.INSTANCE)
.list();
session.getTransaction().commit();
return returnList.size() != 0;
}
/**
* Get the hibernate ID to a given pageID of a category.
* We need different methods for pages and categories here, as a page and a category can have the same ID.
*
* @param pageID A pageID that should be mapped to the corresponding hibernate ID.
* @return The hibernateID of the page with pageID or -1, if the pageID is not valid
*/
protected long __getCategoryHibernateId(int pageID) {
long hibernateID = -1;
// first look in the id mapping cache
if (idMapCategories.containsKey(pageID)) {
return idMapCategories.get(pageID);
}
// The id was not found in the id mapping cache.
// It may not be in the cahe or may not exist at all.
Session session = this.__getHibernateSession();
session.beginTransaction();
Object retObjectPage = session.createQuery(
"select cat.id from Category as cat where cat.pageId = :pageId")
.setParameter("pageId", pageID, IntegerType.INSTANCE)
.uniqueResult();
session.getTransaction().commit();
if (retObjectPage != null) {
hibernateID = (Long) retObjectPage;
// add it to the cache
idMapCategories.put(pageID, hibernateID);
}
return hibernateID;
}
@Test
public void testCriteriaInTest() throws Exception {
Object test = HQLUtils.criteriaInTest(null);
assertTrue(test instanceof TypedParameterValue);
assertTrue(((TypedParameterValue) test).getType() instanceof IntegerType);
assertEquals(Integer.valueOf(0), ((TypedParameterValue) test).getValue());
test = HQLUtils.criteriaInTest(Collections.emptyList());
assertTrue(test instanceof TypedParameterValue);
assertTrue(((TypedParameterValue) test).getType() instanceof IntegerType);
assertEquals(Integer.valueOf(0), ((TypedParameterValue) test).getValue());
test = HQLUtils.criteriaInTest(Collections.singletonList("aBc"));
assertTrue(test instanceof TypedParameterValue);
assertTrue(((TypedParameterValue) test).getType() instanceof IntegerType);
assertEquals(Integer.valueOf(1), ((TypedParameterValue) test).getValue());
}
@SuppressWarnings("unchecked")
@Override
public Map<Integer, Integer> countTotalDownloadedItemsForCollectionIds(final List<Long> ids) {
return (Map<Integer, Integer>) getHibernateTemplate().execute(new HibernateCallback<Object>() {
@Override
public Object doInHibernate(Session session) throws HibernateException {
String sql = " select c.collection_id as id, " +
" sum(c.count) as count " +
" from collection_log c " +
" where c.collection_id in :ids " +
" group by c.collection_id ";
SQLQuery sqlQuery = session.createSQLQuery(sql);
sqlQuery.addScalar("id", new IntegerType());
sqlQuery.addScalar("count", new IntegerType());
sqlQuery.setParameterList("ids", ids);
List<Object[]> list = sqlQuery.list();
Map<Integer, Integer> result = new HashMap<Integer, Integer>();
for (Object[] row : list) {
result.put((Integer) row[0], (Integer) row[1]);
}
return result;
}
});
}
private static Serializable assignIdIfNecessary(Object generatedId, Object entity, String entityName, EventSource source) {
EntityPersister persister = source.getEntityPersister(entityName, entity);
if ( generatedId != null ) {
if (generatedId instanceof Long) {
Long longId = (Long) generatedId;
Type identifierType = persister.getIdentifierType();
if (identifierType == LongType.INSTANCE) {
return longId;
}
else if (identifierType == IntegerType.INSTANCE) {
return longId.intValue();
}
else {
throw new HibernateException("cannot generate identifiers of type "
+ identifierType.getReturnedClass().getSimpleName() + " for: " + entityName);
}
}
else {
return (Serializable) generatedId;
}
}
else {
Serializable assignedId = persister.getIdentifier( entity, source.getSession() );
if (assignedId == null) {
throw new IdentifierGenerationException("ids for this class must be manually assigned before calling save(): " + entityName);
}
return assignedId;
}
}
private Integer numberOfSnapshots(Long sid) {
Session session = HibernateFactory.getSession();
return (Integer) session.createSQLQuery("Select count(*) as cnt " +
" from rhnSnapshot " +
" where server_id = " + sid)
.addScalar("cnt", IntegerType.INSTANCE)
.uniqueResult();
}
@Override
@SuppressWarnings("unchecked")
/** Returns < [surveySession, numUsers] ... [surveySession, numUsers]> */
public List<Object[]> getStatisticsBySession(final Long contentId) {
NativeQuery<Object[]> query = getSession().createNativeQuery(GET_STATISTICS);
query.addEntity(SurveySession.class).addScalar("numUsers", IntegerType.INSTANCE).setParameter("contentId",
contentId);
return query.list();
}
@Override
@SuppressWarnings("unchecked")
public List<MonitoringSummarySessionDTO> statistics(Long toolContentUid) {
NativeQuery<MonitoringSummarySessionDTO> query = getSession().createNativeQuery(DacoSessionDAOHibernate.CALC_SESSION_STATS);
query.addScalar("sessionId", LongType.INSTANCE).addScalar("sessionName", StringType.INSTANCE)
.addScalar("numberLearners", IntegerType.INSTANCE).addScalar("totalRecordCount", IntegerType.INSTANCE)
.setParameter("contentUid", toolContentUid)
.setResultTransformer(Transformers.aliasToBean(MonitoringSessionStatsDTO.class));
return query.list();
}
@Override
@SuppressWarnings("unchecked")
public List<VoteStatsDTO> getStatisticsBySession(Long toolContentId) {
NativeQuery<VoteStatsDTO> query = getSession().createSQLQuery(GET_STATISTICS);
query.addScalar("sessionUid", LongType.INSTANCE).addScalar("sessionName", StringType.INSTANCE)
.addScalar("countUsersComplete", IntegerType.INSTANCE).setParameter("contentId", toolContentId)
.setResultTransformer(Transformers.aliasToBean(VoteStatsDTO.class));
return query.list();
}
private static boolean mayUseIdDirect(Type idType) {
return idType == StringType.INSTANCE
|| idType == IntegerType.INSTANCE
|| idType == LongType.INSTANCE
|| idType == UUIDBinaryType.INSTANCE
|| idType == UUIDCharType.INSTANCE
|| idType == PostgresUUIDType.INSTANCE;
}
@Override
@SuppressWarnings("unchecked")
public List<StatisticDTO> getStatisticsBySession(final Long contentId) {
NativeQuery<StatisticDTO> query = getSession().createNativeQuery(GET_STATISTICS);
query.addScalar("sessionId", LongType.INSTANCE).addScalar("sessionName", StringType.INSTANCE)
.addScalar("numLearners", IntegerType.INSTANCE).addScalar("numLearnersFinished", IntegerType.INSTANCE)
.setParameter("contentId", contentId).setResultTransformer(Transformers.aliasToBean(StatisticDTO.class));
return query.list();
}
@Override
@SuppressWarnings("unchecked")
public List<StatisticDTO> getStatisticsBySession(final Long contentId) {
NativeQuery<StatisticDTO> query = getSession().createNativeQuery(GET_STATISTICS);
query.addScalar("sessionId", LongType.INSTANCE).addScalar("sessionName", StringType.INSTANCE)
.addScalar("totalUploadedFiles", IntegerType.INSTANCE).addScalar("markedCount", IntegerType.INSTANCE)
.setParameter("contentId", contentId).setResultTransformer(Transformers.aliasToBean(StatisticDTO.class));
List<StatisticDTO> list = query.list();
for (StatisticDTO dto : list) {
dto.setNotMarkedCount(dto.getTotalUploadedFiles() - dto.getMarkedCount());
}
return list;
}
@Override
@SuppressWarnings("unchecked")
public List<StatisticDTO> getLeaderStatisticsBySession(final Long contentId) {
NativeQuery<StatisticDTO> query = getSession().createNativeQuery(GET_LEADER_STATISTICS);
query.addScalar("sessionId", LongType.INSTANCE).addScalar("sessionName", StringType.INSTANCE)
.addScalar("totalUploadedFiles", IntegerType.INSTANCE).addScalar("markedCount", IntegerType.INSTANCE)
.setParameter("contentId", contentId).setResultTransformer(Transformers.aliasToBean(StatisticDTO.class));
List<StatisticDTO> list = query.list();
for (StatisticDTO dto : list) {
dto.setNotMarkedCount(dto.getTotalUploadedFiles() - dto.getMarkedCount());
}
return list;
}
@Override
@SuppressWarnings("unchecked")
public SortedSet<Comment> getThreadByThreadId(Long threadCommentId, Integer sortBy, Integer userId) {
NativeQuery<Object[]> query = getSession().createNativeQuery(SQL_QUERY_GET_COMPLETE_THREAD);
query.addEntity("comment", Comment.class).addScalar("likes_total", IntegerType.INSTANCE)
.addScalar("user_vote", IntegerType.INSTANCE).setParameter("userId", userId != null ? userId : 0)
.setParameter("threadId", threadCommentId);
List<Object[]> results = query.list();
return upgradeComments(results, sortBy);
}
@SuppressWarnings({ "unchecked" })
private SortedSet<Comment> getNextThreadByThreadIdLikes(final Long rootTopicId, final Long previousThreadMessageId,
Integer numberOfThreads, Integer sortBy, String extraSortParam, Integer userId) {
// the search to get to the top level is quite heavy and involves grouping the likes, so get all the data
// for the top level then get the child replies.
List<Object[]> topThreadObjects = null;
if (previousThreadMessageId == null || previousThreadMessageId == 0L) {
topThreadObjects = getSession().createSQLQuery(SQL_QUERY_FIND_FIRST_THREAD_TOP_BY_LIKES)
.addEntity("comment", Comment.class).addScalar("likes_total", IntegerType.INSTANCE)
.addScalar("user_vote", IntegerType.INSTANCE).setParameter("rootUid", rootTopicId)
.setParameter("userId", userId != null ? userId : 0).setMaxResults(numberOfThreads).list();
} else {
// get more entries with the same number of likes or less likes
topThreadObjects = getSession().createSQLQuery(SQL_QUERY_FIND_NEXT_THREAD_TOP_BY_LIKE)
.addEntity("comment", Comment.class).addScalar("likes_total", IntegerType.INSTANCE)
.addScalar("user_vote", IntegerType.INSTANCE).setParameter("rootUid", rootTopicId)
.setParameter("lastUid", previousThreadMessageId).setParameter("like", extraSortParam)
.setParameter("userId", userId != null ? userId : 0).setMaxResults(numberOfThreads).list();
}
if (topThreadObjects != null && topThreadObjects.size() > 0) {
// build the list of uids
List<Number> threadUidList = new ArrayList<Number>();
for (Object[] rawObject : topThreadObjects) {
Comment comment = (Comment) rawObject[0];
threadUidList.add(comment.getUid());
}
NativeQuery<Object[]> query = getSession().createNativeQuery(SQL_QUERY_FIND_NEXT_THREAD_MESSAGES_REPLIES_ONLY);
query.addEntity("comment", Comment.class).addScalar("likes_total", IntegerType.INSTANCE)
.addScalar("user_vote", IntegerType.INSTANCE).setParameter("userId", userId != null ? userId : 0)
.setParameterList("threadIds", threadUidList);
List<Object[]> results = query.list();
topThreadObjects.addAll(results);
return upgradeComments(topThreadObjects, sortBy);
}
return new TreeSet<Comment>();
}
@Override
public void configure(Type type, Properties params, Dialect dialect) throws MappingException {
this.idColumn = getParam(dialect, OBJECT_ID_COLUMN, params);
this.versionColumn = getParam(dialect, OBJECT_VERSION_COLUMN, params);
this.tableName = getParam(dialect, OBJECT_TABLE_NAME, params);
super.configure(IntegerType.INSTANCE, params, dialect);
}
private String buildSelectVersionQuery(SessionImplementor session, String versionName, String idName, String tableName) {
Dialect dialect = session.getFactory().getDialect();
final String alias = "tbl";
List<String> maxArgs = new ArrayList<>();
maxArgs.add(StringHelper.qualify(alias, versionName));
String maxFunction = dialect.getFunctions().get("max").render(IntegerType.INSTANCE, maxArgs, session.getFactory());
String sql = "select " + maxFunction + " from " + tableName + ' ' + alias + " where " + StringHelper.qualify(alias, idName) + " = ?";
return sql;
}
public SQLiteDialect() {
super();
registerColumnType(Types.BIT, "integer");
registerColumnType(Types.TINYINT, "tinyint");
registerColumnType(Types.SMALLINT, "smallint");
registerColumnType(Types.INTEGER, "integer");
registerColumnType(Types.BIGINT, "bigint");
registerColumnType(Types.FLOAT, "float");
registerColumnType(Types.REAL, "real");
registerColumnType(Types.DOUBLE, "double");
registerColumnType(Types.NUMERIC, "numeric");
registerColumnType(Types.DECIMAL, "decimal");
registerColumnType(Types.CHAR, "char");
registerColumnType(Types.VARCHAR, 255, "varchar($l)");
registerColumnType(Types.LONGVARCHAR, "longvarchar");
registerColumnType(Types.DATE, "date");
registerColumnType(Types.TIME, "time");
registerColumnType(Types.TIMESTAMP, "timestamp");
registerColumnType(Types.BINARY, "blob");
registerColumnType(Types.VARBINARY, "blob");
registerColumnType(Types.LONGVARBINARY, "blob");
registerColumnType(Types.BLOB, "blob");
registerColumnType(Types.CLOB, "clob");
registerColumnType(Types.BOOLEAN, "integer");
registerHibernateType(Types.NULL, "null");
registerFunction("concat", new VarArgsSQLFunction(StringType.INSTANCE,
"", "||", ""));
registerFunction("mod", new SQLFunctionTemplate(IntegerType.INSTANCE,
"?1 % ?2"));
registerFunction("substr", new StandardSQLFunction("substr",
StringType.INSTANCE));
registerFunction("substring", new StandardSQLFunction("substr",
StringType.INSTANCE));
}
private void fetchByPageId(int pageID)
throws WikiApiException
{
Session session = this.wiki.__getHibernateSession();
session.beginTransaction();
hibernatePage = (de.tudarmstadt.ukp.wikipedia.api.hibernate.Page) session
.createQuery("from Page where pageId = :id").setParameter("id", pageID, IntegerType.INSTANCE).uniqueResult();
session.getTransaction().commit();
if (hibernatePage == null) {
throw new WikiPageNotFoundException("No page with page id " + pageID + " was found.");
}
}
/**
* Gets the title for a given pageId.
*
* @param pageId The id of the page.
* @return The title for the given pageId.
* @throws WikiApiException Thrown if errors occurred.
*/
public Title getTitle(int pageId) throws WikiApiException {
Session session = this.__getHibernateSession();
session.beginTransaction();
Object returnValue = session.createNativeQuery(
"select p.name from PageMapLine as p where p.pageId= :pId").setParameter("pId", pageId, IntegerType.INSTANCE).uniqueResult();
session.getTransaction().commit();
String title = (String)returnValue;
if(title==null){
throw new WikiPageNotFoundException();
}
return new Title(title);
}
/**
* Get the hibernate ID to a given pageID of a page.
* We need different methods for pages and categories here, as a page and a category can have the same ID.
*
* @param pageID A pageID that should be mapped to the corresponding hibernate ID.
* @return The hibernateID of the page with pageID or -1, if the pageID is not valid
*/
protected long __getPageHibernateId(int pageID) {
long hibernateID = -1;
// first look in the id mapping cache
if (idMapPages.containsKey(pageID)) {
return idMapPages.get(pageID);
}
// The id was not found in the id mapping cache.
// It may not be in the cahe or may not exist at all.
Session session = this.__getHibernateSession();
session.beginTransaction();
Object retObjectPage = session.createQuery(
"select page.id from Page as page where page.pageId = :pageId")
.setParameter("pageId", pageID, IntegerType.INSTANCE)
.uniqueResult();
session.getTransaction().commit();
if (retObjectPage != null) {
hibernateID = (Long) retObjectPage;
// add it to the cache
idMapPages.put(pageID, hibernateID);
return hibernateID;
}
return hibernateID;
}
public static void addBitwiseOperationsToDialect() {
SessionFactoryImplementor hibSessionFactory = (SessionFactoryImplementor)new _RootDAO().getSession().getSessionFactory();
Dialect dialect = hibSessionFactory.getDialect();
if (!dialect.getFunctions().containsKey("bit_and")) {
if (isOracle())
dialect.getFunctions().put("bit_and", new StandardSQLFunction("bitand", IntegerType.INSTANCE));
else if (isPostgress())
dialect.getFunctions().put("bit_and", new SQLFunctionTemplate(IntegerType.INSTANCE, "cast(?1 as int) & cast(?2 as int)"));
else
dialect.getFunctions().put("bit_and", new SQLFunctionTemplate(IntegerType.INSTANCE, "?1 & ?2"));
}
}
public static void addAddDateToDialect() {
SessionFactoryImplementor hibSessionFactory = (SessionFactoryImplementor)new _RootDAO().getSession().getSessionFactory();
Dialect dialect = hibSessionFactory.getDialect();
if (isPostgress() && !dialect.getFunctions().containsKey("adddate")) {
dialect.getFunctions().put("adddate", new SQLFunctionTemplate(IntegerType.INSTANCE, "?1 + (?2) * interval '1 day'"));
}
}
protected Object get(Class clazz, String id) {
if (clazz.equals(String.class) || clazz.equals(StringType.class)) return id;
if (clazz.equals(Character.class) || clazz.equals(CharacterType.class)) return (id == null || id.isEmpty() ? null : id.charAt(0));
if (clazz.equals(Byte.class) || clazz.equals(ByteType.class)) return Byte.valueOf(id);
if (clazz.equals(Short.class) || clazz.equals(ShortType.class)) return Short.valueOf(id);
if (clazz.equals(Integer.class) || clazz.equals(IntegerType.class)) return Integer.valueOf(id);
if (clazz.equals(Long.class) || clazz.equals(LongType.class)) return Long.valueOf(id);
if (clazz.equals(Float.class) || clazz.equals(FloatType.class)) return Float.valueOf(id);
if (clazz.equals(Double.class) || clazz.equals(DoubleType.class)) return Double.valueOf(id);
if (clazz.equals(Boolean.class) || clazz.equals(BooleanType.class)) return Boolean.valueOf(id);
Map<String, Entity> entities = iEntities.get(clazz.getName());
if (entities != null) {
Entity entity = entities.get(id);
if (entity != null) return entity.getObject();
}
for (Map.Entry<String, Map<String, Entity>> entry: iEntities.entrySet()) {
Entity o = entry.getValue().get(id);
if (o != null && clazz.isInstance(o.getObject())) return o.getObject();
}
if (clazz.equals(Session.class))
return ((Entity)iEntities.get(Session.class.getName()).values().iterator().next()).getObject();
if (clazz.equals(Student.class))
return checkUnknown(clazz, id, iStudents.get(id));
if (iIsClone)
return checkUnknown(clazz, id,
iHibSession.get(clazz, clazz.equals(ItypeDesc.class) ? (Serializable) Integer.valueOf(id) : (Serializable) Long.valueOf(id)));
return checkUnknown(clazz, id, null);
}