本文整理汇总了Java中org.springframework.dao.support.DataAccessUtils.uniqueResult方法的典型用法代码示例。如果您正苦于以下问题:Java DataAccessUtils.uniqueResult方法的具体用法?Java DataAccessUtils.uniqueResult怎么用?Java DataAccessUtils.uniqueResult使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.dao.support.DataAccessUtils
的用法示例。
在下文中一共展示了DataAccessUtils.uniqueResult方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getByName
import org.springframework.dao.support.DataAccessUtils; //导入方法依赖的package包/类
public User getByName (final String name)
{
User user = (User)DataAccessUtils.uniqueResult (
getHibernateTemplate ().find (
"From User u where u.username=?", name));
// Optimization user extraction: most of the users uses case-sensitive
// match for the login. A Requirement of the project asked for non-case
// sensitive match. The extraction of non-case sensitive login from
// database requires conversions and forbid the usage of indexes, so it
// is much more slow.
// This Fix aims to first try the extraction of the user with exact match
// equals operator, then if not match use the toLower conversion.
if (user==null)
user = (User)DataAccessUtils.uniqueResult (
getHibernateTemplate ().find (
"From User u where lower(u.username)=lower(?)", name));
return user;
}
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:20,代码来源:UserDao.java示例2: findServerLastDailyUsage
import org.springframework.dao.support.DataAccessUtils; //导入方法依赖的package包/类
/**
* Najde posledni zname vyuziti zdroju serveru
*
* @return
*/
@Override
public DailyUsage findServerLastDailyUsage(Integer serverId) {
StringBuilder jpql = new StringBuilder();
jpql.append(" SELECT dailyUsage ");
jpql.append(" FROM DailyUsage AS dailyUsage ");
jpql.append(" JOIN dailyUsage.dailyImport AS dailyImport ");
jpql.append(" WHERE dailyUsage.server.id = :serverId ");
jpql.append(" ORDER BY dailyImport.date DESC ");
TypedQuery<DailyUsage> query = em.createQuery(jpql.toString(), DailyUsage.class);
query.setMaxResults(1);
query.setParameter("serverId", serverId);
return DataAccessUtils.uniqueResult(query.getResultList());
}
开发者ID:CIT-VSB-TUO,项目名称:ResBill,代码行数:21,代码来源:DailyUsageDAOImpl.java示例3: getNextOrder
import org.springframework.dao.support.DataAccessUtils; //导入方法依赖的package包/类
/**
* Pro pozadovany kontrakt najde nejblizsi volne poradove cislo trasnakce v ramci tohoto kontraktu
*/
@Override
public Integer getNextOrder(Integer contractId) {
StringBuilder jpql = new StringBuilder();
jpql.append(" SELECT MAX(transaction.order) ");
jpql.append(" FROM Transaction AS transaction ");
jpql.append(" JOIN transaction.contract AS contract ");
jpql.append(" WHERE contract.id = :contractId ");
TypedQuery<Integer> query = em.createQuery(jpql.toString(), Integer.class);
query.setParameter("contractId", contractId);
Integer maxOrder = DataAccessUtils.uniqueResult(query.getResultList());
if (maxOrder == null) {
maxOrder = 0;
}
return maxOrder + 1;
}
开发者ID:CIT-VSB-TUO,项目名称:ResBill,代码行数:23,代码来源:TransactionDAOImpl.java示例4: getByCodeUserLoadAllData
import org.springframework.dao.support.DataAccessUtils; //导入方法依赖的package包/类
public UserData getByCodeUserLoadAllData(String codeUser) {
MyLogger.info(log, CLASS_NAME, "getByCodeUserLoadAllData", "codeUser="+codeUser, "START");
Criteria criteria = getHibernateTemplate().getSessionFactory().getCurrentSession()
.createCriteria(UserData.class, "user")
.add( Restrictions.eq("user.codeUser", codeUser) )
.createAlias("user.profiles", "profile", Criteria.LEFT_JOIN)
.createAlias("user.roles", "role", Criteria.LEFT_JOIN)
.createAlias("role.permissions", "permission", Criteria.LEFT_JOIN)
.setResultTransformer( Criteria.DISTINCT_ROOT_ENTITY );
UserData data = (UserData) DataAccessUtils.uniqueResult( criteria.list() );
MyLogger.info(log, CLASS_NAME, "getByCodeUser", "codeUser="+codeUser, "END");
return data;
}
开发者ID:ganzux,项目名称:SIRME,代码行数:19,代码来源:UsersDaoImpl.java示例5: getUserFromScanner
import org.springframework.dao.support.DataAccessUtils; //导入方法依赖的package包/类
/**
* Retrieve the owner user of a file scanner.
* @param fs the scanner to retrieve the user.
* @return the owner.
*/
public User getUserFromScanner (FileScanner fs)
{
return (User)DataAccessUtils.uniqueResult (getHibernateTemplate ().find (
"select u from User u where ? in elements(u.preferences.fileScanners)",
fs));
}
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:12,代码来源:FileScannerDao.java示例6: getProductByPath
import org.springframework.dao.support.DataAccessUtils; //导入方法依赖的package包/类
public Product getProductByPath (final URL path)
{
if (path == null)
return null;
Product p = (Product)DataAccessUtils.uniqueResult(getHibernateTemplate().
find("from Product where path=? AND processed=true",path));
return p;
}
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:11,代码来源:ProductDao.java示例7: exists
import org.springframework.dao.support.DataAccessUtils; //导入方法依赖的package包/类
/**
* Does the product corresponding to the given url exist in the database ?
* Processed or not.
*/
public boolean exists (URL url)
{
if (url == null)
return false;
Product p = (Product)DataAccessUtils.uniqueResult(getHibernateTemplate().
find("from Product where path=?", url));
return p != null;
}
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:15,代码来源:ProductDao.java示例8: findServer
import org.springframework.dao.support.DataAccessUtils; //导入方法依赖的package包/类
/**
*
*/
@Override
public Server findServer(String serverId) {
StringBuilder jpql = new StringBuilder();
jpql.append(" SELECT server ");
jpql.append(" FROM Server AS server ");
jpql.append(" WHERE server.serverId = :serverId ");
TypedQuery<Server> query = em.createQuery(jpql.toString(), Server.class);
query.setParameter("serverId", serverId);
return DataAccessUtils.uniqueResult(query.getResultList());
}
开发者ID:CIT-VSB-TUO,项目名称:ResBill,代码行数:17,代码来源:ServerDAOImpl.java示例9: findDailyImport
import org.springframework.dao.support.DataAccessUtils; //导入方法依赖的package包/类
/**
*
*/
@Override
public DailyImport findDailyImport(Date date) {
StringBuilder jpql = new StringBuilder();
jpql.append(" SELECT dailyImport ");
jpql.append(" FROM DailyImport AS dailyImport ");
jpql.append(" WHERE dailyImport.date = :date ");
TypedQuery<DailyImport> query = em.createQuery(jpql.toString(), DailyImport.class);
query.setParameter("date", date);
return DataAccessUtils.uniqueResult(query.getResultList());
}
开发者ID:CIT-VSB-TUO,项目名称:ResBill,代码行数:17,代码来源:DailyImportDAOImpl.java示例10: findProductionLevel
import org.springframework.dao.support.DataAccessUtils; //导入方法依赖的package包/类
/**
*
*/
@Override
public ProductionLevel findProductionLevel(String productionLevelCode) {
StringBuilder jpql = new StringBuilder();
jpql.append(" SELECT prodLev ");
jpql.append(" FROM ProductionLevel AS prodLev ");
jpql.append(" WHERE LOWER(prodLev.code) = :code ");
TypedQuery<ProductionLevel> query = em.createQuery(jpql.toString(), ProductionLevel.class);
query.setParameter("code", productionLevelCode.toLowerCase());
return DataAccessUtils.uniqueResult(query.getResultList());
}
开发者ID:CIT-VSB-TUO,项目名称:ResBill,代码行数:17,代码来源:ProductionLevelDAOImpl.java示例11: getProductByUuid
import org.springframework.dao.support.DataAccessUtils; //导入方法依赖的package包/类
public Product getProductByUuid (String uuid)
{
@SuppressWarnings ("unchecked")
Product product = (Product) DataAccessUtils.uniqueResult (
find ("from Product p where p.uuid='" + uuid +
"' AND p.processed=true"));
return product;
}
开发者ID:SentinelDataHub,项目名称:DataHubSystem,代码行数:9,代码来源:ProductDao.java示例12: getRootApplication
import org.springframework.dao.support.DataAccessUtils; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public ApplicationData getRootApplication() {
MyLogger.info(log, CLASS_NAME,"getRootApplication()","","START");
DetachedCriteria criteria =
DetachedCriteria.forClass(ApplicationData.class)
.add(Restrictions.eq("levelApplication", ApplicationData.ROOT_LEVEL));
ApplicationData application = (ApplicationData)DataAccessUtils.uniqueResult(getHibernateTemplate().findByCriteria(criteria));
MyLogger.info(log, CLASS_NAME,"getRootApplication()","","END");
return application;
}
开发者ID:ganzux,项目名称:SIRME,代码行数:16,代码来源:ApplicationsDaoImpl.java示例13: getOwnerOfProduct
import org.springframework.dao.support.DataAccessUtils; //导入方法依赖的package包/类
public User getOwnerOfProduct (final Product product)
{
return (User)DataAccessUtils.uniqueResult(getHibernateTemplate().find(
"select p.owner from Product p where p=?", product));
}
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:6,代码来源:ProductDao.java本文标签属性:
示例:示例图
代码:代码转换器
java:javascript18岁
DataAccessUtils:DataAccessUtils
uniqueResult:uniqueResult