You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@roller.apache.org by ag...@apache.org on 2007/01/09 20:59:01 UTC
svn commit: r494546 -
/incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernateUserManagerImpl.java
Author: agilliland
Date: Tue Jan 9 11:59:00 2007
New Revision: 494546
URL: http://svn.apache.org/viewvc?view=rev&rev=494546
Log:
small query optimization fix. instead of adding the isenabled=<true/false> criteria to the query, just check it after the object is returned. this ensures that the website.handle index is used for the lookup.
Modified:
incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernateUserManagerImpl.java
Modified: incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernateUserManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernateUserManagerImpl.java?view=diff&rev=494546&r1=494545&r2=494546
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernateUserManagerImpl.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernateUserManagerImpl.java Tue Jan 9 11:59:00 2007
@@ -448,17 +448,7 @@
try {
Session session = ((HibernatePersistenceStrategy)this.strategy).getSession();
Criteria criteria = session.createCriteria(WebsiteData.class);
-
- if (enabled != null) {
- criteria.add(
- Expression.conjunction()
- .add(new IgnoreCaseEqExpression("handle", handle))
- .add(Expression.eq("enabled", enabled)));
- } else {
- criteria.add(
- Expression.conjunction()
- .add(Expression.eq("handle", handle)));
- }
+ criteria.add(new IgnoreCaseEqExpression("handle", handle));
WebsiteData website = (WebsiteData) criteria.uniqueResult();
@@ -468,7 +458,14 @@
this.weblogHandleToIdMap.put(website.getHandle(), website.getId());
}
- return website;
+ // enforce check against enabled status
+ if(website != null &&
+ (enabled == null || enabled.equals(website.getEnabled()))) {
+ return website;
+ } else {
+ return null;
+ }
+
} catch (HibernateException e) {
throw new RollerException(e);
}