当前位置: 首页>>代码示例>>Java>>正文


Java IntegerType类代码示例

本文整理汇总了Java中org.hibernate.type.IntegerType的典型用法代码示例。如果您正苦于以下问题:Java IntegerType类的具体用法?Java IntegerType怎么用?Java IntegerType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IntegerType类属于org.hibernate.type包,在下文中一共展示了IntegerType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getStatisticsBySession

import org.hibernate.type.IntegerType; //导入依赖的package包/类
@Override
   @SuppressWarnings("unchecked")
   public List<VoteStatsDTO> getStatisticsBySession(Long toolContentId) {

SQLQuery query = getSession().createSQLQuery(GET_STATISTICS);
query.addScalar("sessionUid", LongType.INSTANCE).addScalar("sessionName", StringType.INSTANCE)
	.addScalar("countUsersComplete", IntegerType.INSTANCE).setLong("contentId", toolContentId)
	.setResultTransformer(Transformers.aliasToBean(VoteStatsDTO.class));

return query.list();
   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:12,代码来源:VoteUsrAttemptDAO.java

示例2: getStatsMarksForLeaders

import org.hibernate.type.IntegerType; //导入依赖的package包/类
@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.setLong("toolContentId", toolContentId);
List list = query.list();
if ((list == null) || (list.size() == 0)) {
    return null;
} else {
    return (Object[]) list.get(0);
}
   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:18,代码来源:AssessmentUserDAOHibernate.java

示例3: disassemble

import org.hibernate.type.IntegerType; //导入依赖的package包/类
@Override
@SuppressWarnings("deprecation")
public Serializable disassemble(CollectionPersister persister) throws HibernateException {
	final Type elementType = persister.getElementType();
	final String indexNodeName = getIndexAttributeName( persister );
	final List elements =  element.elements( persister.getElementNodeName() );
	final int length = elements.size();
	final Serializable[] result = new Serializable[length];
	for ( int i=0; i<length; i++ ) {
		final Element elem = (Element) elements.get( i );
		final Object object = elementType.fromXMLNode( elem, persister.getFactory() );
		final Integer index = IntegerType.INSTANCE.fromString( getIndex( elem, indexNodeName, i ) );
		result[index] = elementType.disassemble( object, getSession(), null );
	}
	return result;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:17,代码来源:PersistentListElementHolder.java

示例4: getStatsMarksForLeaders

import org.hibernate.type.IntegerType; //导入依赖的package包/类
@Override
   public Object[] getStatsMarksForLeaders(Long toolContentId) {
Query query = getSession().createSQLQuery(FIND_MARK_STATS)
	.addScalar("min_grade", FloatType.INSTANCE)
	.addScalar("avg_grade", FloatType.INSTANCE)
	.addScalar("max_grade", FloatType.INSTANCE)
	.addScalar("num_complete", IntegerType.INSTANCE);
query.setLong("toolContentId", toolContentId);
@SuppressWarnings("rawtypes")
List list = query.list();
if ((list == null) || (list.size() == 0)) {
    return null;
} else {
    return (Object[]) list.get(0);
}
   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:17,代码来源:ScratchieSessionDAOHibernate.java

示例5: getNextThreadByThreadIdNewestFirst

import org.hibernate.type.IntegerType; //导入依赖的package包/类
@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)
	    .setLong("rootUid", rootTopicId).setMaxResults(numberOfThreads).list();
} else {
    threadUidList = getSession().createSQLQuery(SQL_QUERY_FIND_NEXT_THREAD_TOP).setLong("rootUid", rootTopicId)
	    .setLong("lastUid", previousThreadMessageId).setMaxResults(numberOfThreads).list();
}

if (threadUidList != null && threadUidList.size() > 0) {
    SQLQuery query = getSession().createSQLQuery(SQL_QUERY_FIND_NEXT_THREAD_MESSAGES);
    query.addEntity("comment", Comment.class).addScalar("likes_total", IntegerType.INSTANCE)
	    .addScalar("user_vote", IntegerType.INSTANCE).setLong("userId", userId != null ? userId : 0)
	    .setParameterList("threadIds", threadUidList);
    List<Object[]> results = query.list();
    return upgradeComments(results, sortBy);
}
return new TreeSet<Comment>();
   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:26,代码来源:CommentDAO.java

示例6: getStickyByThreadIdNewestFirst

import org.hibernate.type.IntegerType; //导入依赖的package包/类
@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().createSQLQuery(SQL_QUERY_FIND_STICKY_BY_UID)
	.setLong("rootUid", rootTopicId).list();

if (threadUidList != null && threadUidList.size() > 0) {
    SQLQuery query = getSession().createSQLQuery(SQL_QUERY_FIND_NEXT_THREAD_MESSAGES);
    query.addEntity("comment", Comment.class).addScalar("likes_total", IntegerType.INSTANCE)
	    .addScalar("user_vote", IntegerType.INSTANCE).setLong("userId", userId != null ? userId : 0)
	    .setParameterList("threadIds", threadUidList);
    List<Object[]> results = query.list();
    return upgradeComments(results, sortBy);
}
return new TreeSet<Comment>();
   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:19,代码来源:CommentDAO.java

示例7: getStickyByThreadIdLikes

import org.hibernate.type.IntegerType; //导入依赖的package包/类
@SuppressWarnings({ "unchecked" })
   private SortedSet<Comment> getStickyByThreadIdLikes(final Long rootTopicId, Integer sortBy, String extraSortParam,
    Integer userId) {

List<Object[]> topThreadObjects = getSession().createSQLQuery(SQL_QUERY_FIND_STICKY_BY_LIKES)
	.addEntity("comment", Comment.class).addScalar("likes_total", IntegerType.INSTANCE)
	.addScalar("user_vote", IntegerType.INSTANCE).setLong("rootUid", rootTopicId)
	.setLong("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());
    }
    SQLQuery query = getSession().createSQLQuery(SQL_QUERY_FIND_NEXT_THREAD_MESSAGES_REPLIES_ONLY);
    query.addEntity("comment", Comment.class).addScalar("likes_total", IntegerType.INSTANCE)
	    .addScalar("user_vote", IntegerType.INSTANCE).setLong("userId", userId != null ? userId : 0)
	    .setParameterList("threadIds", threadUidList);
    List<Object[]> results = query.list();
    topThreadObjects.addAll(results);
    return upgradeComments(topThreadObjects, sortBy);
}
return new TreeSet<Comment>();
   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:27,代码来源:CommentDAO.java

示例8: get

import org.hibernate.type.IntegerType; //导入依赖的package包/类
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);
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:30,代码来源:SessionRestore.java

示例9: existsPage

import org.hibernate.type.IntegerType; //导入依赖的package包/类
/**
 * 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 True, if a page with that pageID exits, false otherwise.
 */
public boolean existsPage(int pageID) {

    // TODO carefully, 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.
    // This should get a unit test to make sure the encoding function is in line with the title object.
    // 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;
}
 
开发者ID:dkpro,项目名称:dkpro-jwpl,代码行数:29,代码来源:Wikipedia.java

示例10: __getCategoryHibernateId

import org.hibernate.type.IntegerType; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:dkpro,项目名称:dkpro-jwpl,代码行数:33,代码来源:Wikipedia.java

示例11: addScalars

import org.hibernate.type.IntegerType; //导入依赖的package包/类
private void addScalars(SQLQuery query)
{
	query.addScalar("URI", StringType.INSTANCE);
	query.addScalar("foundTimestamp", LongType.INSTANCE);
	query.addScalar("canonicalTag", StringType.INSTANCE);
	query.addScalar("httpStatusCode", IntegerType.INSTANCE);
	query.addScalar("lastCrawledTimestamp", LongType.INSTANCE);
	query.addScalar("contentHashcode", StringType.INSTANCE);
	query.addScalar("backgroundId", ShortType.INSTANCE);
	query.addScalar("qualityScore", ShortType.INSTANCE);
	query.addScalar("spamScore", ShortType.INSTANCE);
	query.addScalar("readingLevel", ShortType.INSTANCE);
	query.addScalar("varietyTopicScore", ShortType.INSTANCE);
	query.addScalar("adScripts", ShortType.INSTANCE);
	query.addScalar("relevantImages", BooleanType.INSTANCE);
	query.addScalar("responseTime", IntegerType.INSTANCE);
	query.addScalar("pageSize", IntegerType.INSTANCE);
	query.addScalar("pageRank", DoubleType.INSTANCE);
	query.addScalar("qwLocale", StringType.INSTANCE);
	query.addScalar("onPageText", StringType.INSTANCE);
	query.addScalar("title", StringType.INSTANCE);
	query.addScalar("metaDescription", StringType.INSTANCE);
	query.addScalar("topicKeyword", StringType.INSTANCE);
	query.addScalar("robotsIndex", BooleanType.INSTANCE);
	query.addScalar("duplicateTitle", BooleanType.INSTANCE);
	query.addScalar("duplicateMetaDescription", BooleanType.INSTANCE);
	query.addScalar("duplicateContent", BooleanType.INSTANCE);
	query.addScalar("trailingSlashIssue", BooleanType.INSTANCE);
	query.addScalar("timeout", BooleanType.INSTANCE);
	query.addScalar("pagination", BooleanType.INSTANCE);
	query.addScalar("dcPrimary", BooleanType.INSTANCE);
}
 
开发者ID:bonprix,项目名称:solidsearch-bot,代码行数:33,代码来源:URLRestManager.java

示例12: addScalars

import org.hibernate.type.IntegerType; //导入依赖的package包/类
private void addScalars(SQLQuery query)
{
	query.addScalar("resultFromTimestampMills", LongType.INSTANCE);
	query.addScalar("qualityScore", ShortType.INSTANCE);
	query.addScalar("totalLinks", LongType.INSTANCE);
	query.addScalar("internalURLs", LongType.INSTANCE);
	query.addScalar("internalNoindexURLs", LongType.INSTANCE);
	query.addScalar("internalIndexURLs", LongType.INSTANCE);
	query.addScalar("externalURLs", LongType.INSTANCE);
	query.addScalar("externalURLsDifferentDomains", LongType.INSTANCE);
	query.addScalar("crawledURLs", LongType.INSTANCE);
	query.addScalar("clientErrorURLs", LongType.INSTANCE);
	query.addScalar("timeoutURLs", LongType.INSTANCE);
	query.addScalar("redirectionURLs", LongType.INSTANCE);
	query.addScalar("serverErrorURLs", LongType.INSTANCE);
	query.addScalar("avgResponseTimeMills", IntegerType.INSTANCE);
	query.addScalar("medianResponseTimeMills", IntegerType.INSTANCE);
	query.addScalar("avgPageSize", LongType.INSTANCE);
	query.addScalar("totalCountOfRelevantKeywords", LongType.INSTANCE);
	query.addScalar("totalCountOfKeywords", LongType.INSTANCE);
	query.addScalar("avgReadingLevel", DoubleType.INSTANCE);
	query.addScalar("domainBrandName", StringType.INSTANCE);
	query.addScalar("homeDocument", StringType.INSTANCE);
}
 
开发者ID:bonprix,项目名称:solidsearch-bot,代码行数:25,代码来源:DomainRestManager.java

示例13: countTotalDownloadedItemsForCollectionIds

import org.hibernate.type.IntegerType; //导入依赖的package包/类
@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;
        }
    });
}
 
开发者ID:qcri-social,项目名称:AIDR,代码行数:27,代码来源:CollectionLogRepositoryImpl.java

示例14: getUserWebFormFileMaxNum

import org.hibernate.type.IntegerType; //导入依赖的package包/类
@Override
public Number getUserWebFormFileMaxNum(String userId, String xmlSchema, String fileName, char numDelim, char extensionDelim) {
    String fileNameSearchCriteria;
    String maxProjection;

    int lastIndexOfDot = fileName.lastIndexOf(extensionDelim);
    if (lastIndexOfDot > 0) {
        fileNameSearchCriteria = fileName.substring(0, lastIndexOfDot) + numDelim + "%" + fileName.substring(lastIndexOfDot);
        maxProjection =
                "MAX(CAST(SUBSTRING(file_name, LOCATE('" + numDelim + "', file_name) + 1, LOCATE('" + extensionDelim
                        + "', file_name) - LOCATE('" + numDelim + "', file_name) - 1) AS SIGNED)) AS num";

    } else {
        fileNameSearchCriteria = fileName + numDelim + "%";
        maxProjection = "MAX(CAST(SUBSTRING(file_name, LOCATE('" + numDelim + "', file_name) + 1) AS SIGNED)) AS num";
    }

    return (Number) (getCriteria().add(eq("userId", userId)).add(like("xmlSchema", xmlSchema))
            .add(like("file.name", fileNameSearchCriteria))
            .setProjection(Projections.sqlProjection(maxProjection, new String[] {"num"}, new Type[] {new IntegerType()}))
            .uniqueResult());
}
 
开发者ID:eea,项目名称:eionet.webq,代码行数:23,代码来源:UserFileStorageImpl.java

示例15: SqliteDialect

import org.hibernate.type.IntegerType; //导入依赖的package包/类
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, "varchar");
    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");
    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));
}
 
开发者ID:Martion2017,项目名称:ApplicationDetection,代码行数:30,代码来源:SqliteDialect.java


注:本文中的org.hibernate.type.IntegerType类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。