Skip to content

Commit

Permalink
Upgraded hibernate 3.6.10->4.3.5. Woohoo!
Browse files Browse the repository at this point in the history
  • Loading branch information
hirokiterashima committed Jul 8, 2014
1 parent c4ebb40 commit ea1eec2
Show file tree
Hide file tree
Showing 29 changed files with 108 additions and 158 deletions.
6 changes: 0 additions & 6 deletions .classpath
Expand Up @@ -6,17 +6,11 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="src/test/java"/>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
Expand Down
1 change: 0 additions & 1 deletion .settings/org.eclipse.wst.common.component
Expand Up @@ -5,7 +5,6 @@
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/webapp/WEB-INF"/>
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/test/java"/>
<property name="context-root" value="wise"/>
<property name="java-output-path" value="/target/classes"/>
<property name="component.exclusion.patterns" value="WEB-INF/classes/sample/**,WEB-INF/classes/wise.properties,WEB-INF/classes/wise_development.properties,curriculum/**,studentuploads/**"/>
Expand Down
40 changes: 8 additions & 32 deletions pom.xml
Expand Up @@ -372,36 +372,11 @@
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${org.springframework.version}</version>
<scope>runtime</scope>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>1.5.8</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.5.8</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.5.8</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.14</version>
<version>1.2.17</version>
<scope>runtime</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -442,27 +417,27 @@
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.30</version>
<version>5.1.31</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>3.6.10.Final</version>
<version>${org.hibernate.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-c3p0</artifactId>
<version>3.6.10.Final</version>
<version>${org.hibernate.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-ehcache</artifactId>
<version>3.6.10.Final</version>
<version>${org.hibernate.version}</version>
</dependency>
<dependency>
<groupId>javassist</groupId>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.12.1.GA</version>
<version>3.18.2-GA</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
Expand Down Expand Up @@ -562,6 +537,7 @@
<properties>
<org.springframework.version>4.0.5.RELEASE</org.springframework.version>
<org.springframework.security.version>3.2.4.RELEASE</org.springframework.security.version>
<org.hibernate.version>4.3.5.Final</org.hibernate.version>
<startup.listeners>
</startup.listeners>
</properties>
Expand Down
Expand Up @@ -21,7 +21,7 @@
import java.util.List;


import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import org.springframework.orm.hibernate4.support.HibernateDaoSupport;
import org.wise.portal.dao.ObjectNotFoundException;
import org.wise.portal.dao.SimpleDao;

Expand Down
Expand Up @@ -27,7 +27,7 @@
import java.util.List;
import java.util.Set;


import org.springframework.transaction.annotation.Transactional;
import org.wise.portal.dao.ObjectNotFoundException;
import org.wise.portal.dao.impl.AbstractHibernateDao;
import org.wise.portal.dao.project.ProjectDao;
Expand Down Expand Up @@ -155,6 +155,7 @@ public Project getById(Serializable id) throws ObjectNotFoundException {
* @see org.wise.portal.dao.project.ProjectDao#getProjectListByTags(java.util.Set)
*/
@SuppressWarnings("unchecked")
@Transactional
public List<Project> getProjectListByTagNames(Set<String> tagNames) {
String tagString = "";
for(String name : tagNames){
Expand All @@ -163,7 +164,6 @@ public List<Project> getProjectListByTagNames(Set<String> tagNames) {
tagString = tagString.substring(0, tagString.length() - 1);

String q = "select distinct project from ProjectImpl project inner join project.tags tag with tag.name in (" + tagString + ") ";

List<Project> projects = (List<Project>) this.getHibernateTemplate().find(q);
List<Project> result = new ArrayList<Project>();
for (Project project : projects) {
Expand Down
Expand Up @@ -63,7 +63,7 @@ protected String getFindAllQuery() {
*/
@SuppressWarnings("unchecked")
public List<WISEWorkgroup> getListByOfferingAndUser(Offering offering, User user) {
Session session = this.getSession();
Session session = this.getHibernateTemplate().getSessionFactory().getCurrentSession();
SQLQuery sqlQuery = session
.createSQLQuery("SELECT w.*, g.*, ww.* FROM workgroups as w, groups as g, "
+ "groups_related_to_users as g_r_u, wiseworkgroups as ww "
Expand All @@ -84,7 +84,7 @@ public List<WISEWorkgroup> getListByOfferingAndUser(Offering offering, User user
*/
@SuppressWarnings("unchecked")
public List<WISEWorkgroup> getListByUser(User user) {
Session session = this.getSession();
Session session = this.getHibernateTemplate().getSessionFactory().getCurrentSession();
SQLQuery sqlQuery = session
.createSQLQuery("SELECT w.*, g.*, ww.* FROM workgroups as w, groups as g, "
+ "groups_related_to_users as g_r_u, wiseworkgroups as ww "
Expand Down
Expand Up @@ -59,7 +59,7 @@ protected String getFindAllQuery() {
*/
@SuppressWarnings("unchecked")
public List<Workgroup> getListByOfferingAndUser(Offering offering, User user) {
Session session = this.getSession();
Session session = this.getHibernateTemplate().getSessionFactory().getCurrentSession();
SQLQuery sqlQuery = session
.createSQLQuery("SELECT w.*, g.* FROM workgroups as w, groups as g, "
+ "groups_related_to_users as g_r_u "
Expand All @@ -78,7 +78,7 @@ public List<Workgroup> getListByOfferingAndUser(Offering offering, User user) {
*/
@SuppressWarnings("unchecked")
public List<Workgroup> getListByUser(User user) {
Session session = this.getSession();
Session session = this.getHibernateTemplate().getSessionFactory().getCurrentSession();
SQLQuery sqlQuery = session
.createSQLQuery("SELECT w.*, g.* FROM workgroups as w, groups as g, "
+ "groups_related_to_users as g_r_u "
Expand Down
Expand Up @@ -6,17 +6,22 @@
import javax.servlet.http.HttpServletResponse;

import org.json.JSONArray;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.wise.portal.domain.user.User;
import org.wise.portal.service.user.UserService;

public class CheckForExistingAccountController extends AbstractController {
@Controller
@RequestMapping("checkforexistingaccount.html")
public class CheckForExistingAccountController{

protected UserService userService = null;
@Autowired
protected UserService userService;

@Override
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
@RequestMapping(method=RequestMethod.GET)
protected String handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
//get the account type 'student' or 'teacher'
String accountType = request.getParameter("accountType");

Expand Down Expand Up @@ -91,10 +96,6 @@ protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpSer
response.getWriter().write(existingUserNames.toString());
}

return null;
return "checkforexistingaccount";
}

public void setUserService(UserService userService) {
this.userService = userService;
}
}
Expand Up @@ -34,7 +34,7 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractController;
import org.wise.portal.dao.ObjectNotFoundException;
Expand Down Expand Up @@ -71,6 +71,7 @@ protected ModelAndView handleRequestInternal(HttpServletRequest arg0,
HttpServletResponse arg1) throws Exception {

List<NewsItem> newsItems = newsItemService.retrieveAllNewsItem();

if (newsItems.size() == 0) {
NewsItem newsItem = new NewsItemImpl();
newsItem.setDate(Calendar.getInstance().getTime());
Expand All @@ -83,11 +84,15 @@ protected ModelAndView handleRequestInternal(HttpServletRequest arg0,

Map<Long,String> projectThumbMap = new TreeMap<Long,String>(); // maps projectId to url where its thumbnail can be found

List<NewsItem> newsItems2 = newsItemService.retrieveAllNewsItem();

// get library projects
Set<String> tagNames = new TreeSet<String>();
tagNames.add("library");
tagNames.add("public");
List<Project> libraryProjectsList = this.projectService.getProjectListByTagNames(tagNames);

//List<Project> libraryProjectsList = this.projectService.getProjectListByTagNames(tagNames);
List<Project> libraryProjectsList = new ArrayList<Project>();

// divide library projects by subject area
List<Project> esProjects = new ArrayList<Project>();
Expand Down
Expand Up @@ -27,7 +27,7 @@

import org.hibernate.StaleObjectStateException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.hibernate3.HibernateOptimisticLockingFailureException;
import org.springframework.orm.hibernate4.HibernateOptimisticLockingFailureException;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.validation.BindingResult;
Expand Down
Expand Up @@ -35,7 +35,7 @@

import org.hibernate.StaleObjectStateException;
import org.json.JSONArray;
import org.springframework.orm.hibernate3.HibernateOptimisticLockingFailureException;
import org.springframework.orm.hibernate4.HibernateOptimisticLockingFailureException;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractController;
import org.wise.portal.domain.group.Group;
Expand Down
Expand Up @@ -35,7 +35,7 @@
import org.hibernate.StaleObjectStateException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.propertyeditors.CustomDateEditor;
import org.springframework.orm.hibernate3.HibernateOptimisticLockingFailureException;
import org.springframework.orm.hibernate4.HibernateOptimisticLockingFailureException;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.ui.ModelMap;
Expand Down
Expand Up @@ -35,7 +35,7 @@
import org.hibernate.StaleObjectStateException;
import org.json.JSONArray;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.hibernate3.HibernateOptimisticLockingFailureException;
import org.springframework.orm.hibernate4.HibernateOptimisticLockingFailureException;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.validation.BindingResult;
Expand Down
Expand Up @@ -38,11 +38,10 @@
import net.tanesha.recaptcha.ReCaptcha;
import net.tanesha.recaptcha.ReCaptchaFactory;

import org.springframework.context.ApplicationContext;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler;
import org.springframework.web.context.support.WebApplicationContextUtils;
import org.springframework.transaction.annotation.Transactional;
import org.wise.portal.domain.authentication.MutableUserDetails;
import org.wise.portal.domain.user.User;
import org.wise.portal.service.user.UserService;
Expand All @@ -56,6 +55,8 @@ public class TelsAuthenticationFailureHandler extends

private Properties wiseProperties;

private UserService userService;

public static final Integer recentFailedLoginTimeLimit = 15;

public static final Integer recentFailedLoginAttemptsLimit = 5;
Expand All @@ -65,6 +66,7 @@ public class TelsAuthenticationFailureHandler extends


@Override
@Transactional
public void onAuthenticationFailure(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
AuthenticationException exception)
Expand Down Expand Up @@ -92,10 +94,6 @@ public void onAuthenticationFailure(javax.servlet.http.HttpServletRequest reques
}
}

HttpSession session = request.getSession();
ApplicationContext springContext = WebApplicationContextUtils.getWebApplicationContext(session.getServletContext());
UserService userService = (UserService) springContext.getBean("userService");

//get the user
User user = userService.retrieveUserByUsername(userName);

Expand Down Expand Up @@ -192,10 +190,6 @@ protected String determineFailureUrl(javax.servlet.http.HttpServletRequest reque
}
}

HttpSession session = request.getSession();
ApplicationContext springContext = WebApplicationContextUtils.getWebApplicationContext(session.getServletContext());
UserService userService = (UserService) springContext.getBean("userService");

//get the user
User user = userService.retrieveUserByUsername(userName);

Expand Down Expand Up @@ -308,6 +302,13 @@ public void setWiseProperties(Properties wiseProperties) {
this.wiseProperties = wiseProperties;
}

/**
* @param userService the userService to set
*/
public void setUserService(UserService userService) {
this.userService = userService;
}

/**
* @param authenticationFailureUrl the authenticationFailureUrl to set
*/
Expand Down
Expand Up @@ -37,6 +37,7 @@
* @author patrick lawler
*
*/
@Transactional(readOnly = true)
public class NewsItemServiceImpl implements NewsItemService{

private NewsItemDao<NewsItem> newsItemDao;
Expand All @@ -53,12 +54,10 @@ public NewsItem createNewsItem(Date date, User owner, String title, String news)
return newsItem;
}

@Transactional(readOnly = true)
public List<NewsItem> retrieveAllNewsItem(){
return newsItemDao.getList();
}

@Transactional()
public NewsItem retrieveById(Long id) throws ObjectNotFoundException{
try{
return newsItemDao.getById(id);
Expand Down
Expand Up @@ -316,7 +316,6 @@ public Project createProject(ProjectParameters projectParameters)
* @param Set<String> - set of tagNames
* @return List<Project> - list of projects
*/
@Transactional
public List<Project> getProjectListByTagNames(Set<String> tagNames);

/**
Expand Down

0 comments on commit ea1eec2

Please sign in to comment.