• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java TimestampType类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getUserAttemptsForTablesorter

import org.hibernate.type.TimestampType; //导入依赖的package包/类
@Override
   @SuppressWarnings("unchecked")
   /**
    * Gets the basic details about an attempt for a nomination. questionUid must not be null, sessionUid may be NULL.
    * This is
    * unusual for these methods - usually sessionId may not be null. In this case if sessionUid is null then you get
    * the values for the whole class, not just the group.
    *
    * Will return List<[login (String), fullname(String), attemptTime(Timestamp]>
    */
   public List<Object[]> getUserAttemptsForTablesorter(Long sessionUid, Long questionUid, int page, int size,
    int sorting, String searchString, IUserManagementService userManagementService) {
String sortingOrder;
switch (sorting) {
    case VoteAppConstants.SORT_BY_NAME_ASC:
	sortingOrder = "user.fullname ASC";
	break;
    case VoteAppConstants.SORT_BY_NAME_DESC:
	sortingOrder = "user.fullname DESC";
	break;
    case VoteAppConstants.SORT_BY_DATE_ASC:
	sortingOrder = "attempt.attempt_time ASC";
	break;
    case VoteAppConstants.SORT_BY_DATE_DESC:
	sortingOrder = "attempt.attempt_time DESC";
	break;
    default:
	sortingOrder = "user.uid";
}

String[] portraitStrings = userManagementService.getPortraitSQL("user.user_id");

// Basic select for the user records
StringBuilder queryText = new StringBuilder(FIND_USER_ANSWERS_BY_QUESTION_UID_SELECT)
	.append(portraitStrings[0])
	.append(FIND_USER_ANSWERS_BY_QUESTION_UID_FROM)
	.append(portraitStrings[1]);

if (sessionUid != null) {
    queryText.append(FIND_USER_ANSWERS_BY_QUESTION_UID_SESSION_ADDITION);
}

// If filtering by name add a name based where clause
buildNameSearch(searchString, queryText, true);

// Now specify the sort based on the switch statement above.
queryText.append(" ORDER BY " + sortingOrder);

SQLQuery query = getSession().createSQLQuery(queryText.toString());
query.addScalar("user_id", IntegerType.INSTANCE).addScalar("username", StringType.INSTANCE)
	.addScalar("fullname", StringType.INSTANCE)
	.addScalar("attemptTime", TimestampType.INSTANCE)
	.addScalar("portraitId", IntegerType.INSTANCE)
	.setLong("questionUid", questionUid.longValue())
	.setFirstResult(page * size).setMaxResults(size);
if (sessionUid != null) {
    query.setLong("sessionUid", sessionUid.longValue());
}

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


示例2: nullSafeGet

import org.hibernate.type.TimestampType; //导入依赖的package包/类
@SuppressWarnings("deprecation")
public Object nullSafeGet(ResultSet resultSet, String name) throws SQLException {
  java.sql.Timestamp value = (java.sql.Timestamp) (new TimestampType()).nullSafeGet(resultSet, name);
  if (value == null) {
    return null;
  }
  return DbDateUtils.fromSqlTimestamp(value);
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:9,代码来源:PersistentInstant.java


示例3: nullSafeSet

import org.hibernate.type.TimestampType; //导入依赖的package包/类
@SuppressWarnings("deprecation")
public void nullSafeSet(PreparedStatement preparedStatement, Object value, int index) throws HibernateException, SQLException {
  if (value == null) {
    s_logger.debug("INSTANT -> TIMESTAMP : NULL -> NULL");
    (new TimestampType()).nullSafeSet(preparedStatement, null, index);
  } else {
    s_logger.debug("INSTANT -> TIMESTAMP : {}   ->  {}", value, DbDateUtils.toSqlTimestamp((Instant) value));
    (new TimestampType()).nullSafeSet(preparedStatement, DbDateUtils.toSqlTimestamp((Instant) value), index);
  }
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:11,代码来源:PersistentInstant.java


示例4: getUserNotebookEntriesForTablesorter

import org.hibernate.type.TimestampType; //导入依赖的package包/类
@Override
   @SuppressWarnings("unchecked")
   /**
    * Will return List<[user.user_id, user.first_name, user.last_name, notebook entry, notebook date]>
    */
   public List<Object[]> getUserNotebookEntriesForTablesorter(final Long toolSessionId, int page, int size, int sorting,
    String searchString, ICoreNotebookService coreNotebookService) {

String sortingOrder;
switch (sorting) {
    case PeerreviewConstants.SORT_BY_USERNAME_ASC:
	sortingOrder = " ORDER BY user.first_name ASC";
	break;
    case PeerreviewConstants.SORT_BY_USERNAME_DESC:
	sortingOrder = " ORDER BY user.first_name DESC";
	break;
    case PeerreviewConstants.SORT_BY_NOTEBOOK_ENTRY_ASC:
	sortingOrder = " ORDER BY notebookEntry ASC";
	break;
    case PeerreviewConstants.SORT_BY_NOTEBOOK_ENTRY_DESC:
	sortingOrder = " ORDER BY notebookEntry DESC";
	break;
    case PeerreviewConstants.SORT_BY_NO:
    default:
	sortingOrder = " ORDER BY user.user_id";
}

String[] notebookEntryStrings = coreNotebookService.getNotebookEntrySQLStrings(toolSessionId.toString(),
	    PeerreviewConstants.TOOL_SIGNATURE, "user.user_id", true);

// Basic select for the user records
StringBuilder queryText = new StringBuilder();

queryText.append("SELECT user.user_id, user.first_name, user.last_name ")
	.append(notebookEntryStrings[0])
	.append(" FROM tl_laprev11_user user ")
	.append(" JOIN tl_laprev11_session session ON session.session_id = :toolSessionId AND user.session_uid = session.uid");

queryText.append(notebookEntryStrings[1]);

   	buildNameSearch(searchString, queryText, false);

// Now specify the sort based on the switch statement above.
queryText.append(sortingOrder);

SQLQuery query = getSession().createSQLQuery(queryText.toString());
query.addScalar("user_id", IntegerType.INSTANCE)
	.addScalar("first_name", StringType.INSTANCE)
	.addScalar("last_name", StringType.INSTANCE)
	.addScalar("notebookEntry", StringType.INSTANCE)
	.addScalar("notebookModifiedDate", TimestampType.INSTANCE)
	.setLong("toolSessionId", toolSessionId.longValue())
	.setFirstResult(page * size).setMaxResults(size);
return query.list();

   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:57,代码来源:PeerreviewUserDAOHibernate.java


示例5: getUserOpenTextAttemptsForTablesorter

import org.hibernate.type.TimestampType; //导入依赖的package包/类
@Override
   @SuppressWarnings("unchecked")
   /**
    * Gets the details about an open text entry. Either sessionUid or toolContentId must be supplied - if sessionUid is
    * supplied
    * then it will be restricted to that session. Due to the large number of fields needed, a DTO will be returned.
    *
    * Will return List<OpenTextAnswerDTO>
    */
   public List<OpenTextAnswerDTO> getUserOpenTextAttemptsForTablesorter(Long sessionUid, Long toolContentId, int page,
    int size, int sorting, String searchStringVote, String searchStringUsername, IUserManagementService userManagementService) {
String sortingOrder;
switch (sorting) {
    case VoteAppConstants.SORT_BY_NAME_ASC:
	sortingOrder = "user.fullname ASC";
	break;
    case VoteAppConstants.SORT_BY_NAME_DESC:
	sortingOrder = "user.fullname DESC";
	break;
    case VoteAppConstants.SORT_BY_DATE_ASC:
	sortingOrder = "attempt.attempt_time ASC";
	break;
    case VoteAppConstants.SORT_BY_DATE_DESC:
	sortingOrder = "attempt.attempt_time DESC";
	break;
    case VoteAppConstants.SORT_BY_ENTRY_ASC:
	sortingOrder = "attempt.userEntry ASC";
	break;
    case VoteAppConstants.SORT_BY_ENTRY_DESC:
	sortingOrder = "attempt.userEntry DESC";
	break;
    case VoteAppConstants.SORT_BY_VISIBLE_ASC:
	sortingOrder = "attempt.visible ASC";
	break;
    case VoteAppConstants.SORT_BY_VISIBLE_DESC:
	sortingOrder = "attempt.visible DESC";
	break;
    default:
	sortingOrder = "user.uid";
}

String[] portraitStrings = userManagementService.getPortraitSQL("user.user_id");

// Basic select for the user records
StringBuilder queryText = new StringBuilder(FIND_USER_OPEN_TEXT_SELECT)
	.append(portraitStrings[0])
	.append(FIND_USER_OPEN_TEXT_FROM);

if (sessionUid != null) {
    queryText.append(FIND_USER_OPEN_TEXT_SESSION_UID_ADD);
} else {
    queryText.append(FIND_USER_OPEN_TEXT_CONTENT_UID_ADD);
}
queryText.append(portraitStrings[1]);

// If filtering by name/entry add a where clause
buildCombinedSearch(searchStringVote, searchStringUsername, queryText);

// Now specify the sort based on the switch statement above.
queryText.append(" ORDER BY " + sortingOrder);

SQLQuery query = getSession().createSQLQuery(queryText.toString());
query.addScalar("userUid", LongType.INSTANCE).addScalar("login", StringType.INSTANCE)
	.addScalar("fullName", StringType.INSTANCE).addScalar("userEntryUid", LongType.INSTANCE)
	.addScalar("userEntry", StringType.INSTANCE).addScalar("attemptTime", TimestampType.INSTANCE)
	.addScalar("visible", BooleanType.INSTANCE).addScalar("portraitId", LongType.INSTANCE)
	.setFirstResult(page * size).setMaxResults(size)
	.setResultTransformer(Transformers.aliasToBean(OpenTextAnswerDTO.class));

if (sessionUid != null) {
    query.setLong("sessionUid", sessionUid);
} else {
    query.setLong("toolContentId", toolContentId);
}

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


示例6: getUsersForTablesorter

import org.hibernate.type.TimestampType; //导入依赖的package包/类
@Override
   @SuppressWarnings("unchecked")
   /**
    * Will return List<[NotebookUser, String, Date]> where the String is the notebook entry and the modified date.
    */
   public List<Object[]> getUsersForTablesorter(final Long sessionId, int page, int size, int sorting,
    String searchString, ICoreNotebookService coreNotebookService, IUserManagementService userManagementService) {
String sortingOrder;
switch (sorting) {
    case NotebookConstants.SORT_BY_USERNAME_ASC:
	sortingOrder = "user.last_name ASC, user.first_name ASC";
	break;
    case NotebookConstants.SORT_BY_USERNAME_DESC:
	sortingOrder = "user.last_name DESC, user.first_name DESC";
	break;
    case NotebookConstants.SORT_BY_DATE_ASC:
	sortingOrder = "notebookModifiedDate ASC";
	break;
    case NotebookConstants.SORT_BY_DATE_DESC:
	sortingOrder = "notebookModifiedDate DESC";
	break;
    case NotebookConstants.SORT_BY_COMMENT_ASC:
	sortingOrder = "user.teachers_comment ASC";
	break;
    case NotebookConstants.SORT_BY_COMMENT_DESC:
	sortingOrder = "user.teachers_comment DESC";
	break;
    default:
	sortingOrder = "user.last_name, user.first_name";
}

String[] notebookEntryStrings = coreNotebookService.getNotebookEntrySQLStrings(sessionId.toString(),
	NotebookConstants.TOOL_SIGNATURE, "user.user_id", true);

String[] portraitStrings = userManagementService.getPortraitSQL("user.user_id");

// Basic select for the user records
StringBuilder queryText = new StringBuilder();
queryText.append("SELECT user.* ");
queryText.append(notebookEntryStrings[0]);
queryText.append(portraitStrings[0]);
queryText.append(" FROM tl_lantbk11_user user ");
queryText.append(
	" JOIN tl_lantbk11_session session ON user.notebook_session_uid = session.uid and session.session_id = :sessionId");
queryText.append(notebookEntryStrings[1]);
queryText.append(portraitStrings[1]);

// If filtering by name add a name based where clause
buildNameSearch(searchString, queryText);

// Now specify the sort based on the switch statement above.
queryText.append(" ORDER BY " + sortingOrder);

SQLQuery query = getSession().createSQLQuery(queryText.toString());
query.addEntity("user", NotebookUser.class).addScalar("notebookEntry", StringType.INSTANCE)
	.addScalar("notebookModifiedDate", TimestampType.INSTANCE).addScalar("portraitId", IntegerType.INSTANCE)
	.setLong("sessionId", sessionId.longValue())
	.setFirstResult(page * size).setMaxResults(size);
return query.list();
   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:61,代码来源:NotebookUserDAO.java


示例7: getHibernateType

import org.hibernate.type.TimestampType; //导入依赖的package包/类
@Override
public final TimestampType getHibernateType() {    	
	return TimestampType.INSTANCE;
}
 
开发者ID:JadiraOrg,项目名称:jadira,代码行数:5,代码来源:AbstractTimestampColumnMapper.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java EntityHanging类代码示例发布时间:2022-05-22
下一篇:
Java SearchFragment类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap