Author: manaRH
Date: 2010-11-22 09:50:14 -0500 (Mon, 22 Nov 2010)
New Revision: 13923
Modified:
branches/community/Seam_2_2/examples/spring/build-jboss6.xml
branches/community/Seam_2_2/examples/spring/build-jbosswar.xml
branches/community/Seam_2_2/examples/spring/src/org/jboss/seam/example/spring/UserService.java
Log:
removed hsearch libs from example, fixed invalid user login
Modified: branches/community/Seam_2_2/examples/spring/build-jboss6.xml
===================================================================
--- branches/community/Seam_2_2/examples/spring/build-jboss6.xml 2010-11-22 13:19:40 UTC
(rev 13922)
+++ branches/community/Seam_2_2/examples/spring/build-jboss6.xml 2010-11-22 14:50:14 UTC
(rev 13923)
@@ -12,8 +12,6 @@
<property name="facelets.lib" value="true"/>
<property name="seam.ioc.war.lib" value="true"/>
<property name="spring.lib" value="true"/>
- <!-- needed because jboss must include hibernate search -->
- <property name="search.lib" value="true"/>
<property name="richfaces.lib" value="true"/>
<property name="cglib.lib" value="true"/>
Modified: branches/community/Seam_2_2/examples/spring/build-jbosswar.xml
===================================================================
--- branches/community/Seam_2_2/examples/spring/build-jbosswar.xml 2010-11-22 13:19:40 UTC
(rev 13922)
+++ branches/community/Seam_2_2/examples/spring/build-jbosswar.xml 2010-11-22 14:50:14 UTC
(rev 13923)
@@ -17,8 +17,6 @@
<property name="facelets.lib" value="true"/>
<property name="seam.ioc.war.lib" value="true"/>
<property name="spring.lib" value="true"/>
- <!-- needed because jboss must include hibernate search -->
- <property name="search.lib" value="true"/>
<property name="richfaces.lib" value="true"/>
<property name="cglib.lib" value="true"/>
Modified:
branches/community/Seam_2_2/examples/spring/src/org/jboss/seam/example/spring/UserService.java
===================================================================
---
branches/community/Seam_2_2/examples/spring/src/org/jboss/seam/example/spring/UserService.java 2010-11-22
13:19:40 UTC (rev 13922)
+++
branches/community/Seam_2_2/examples/spring/src/org/jboss/seam/example/spring/UserService.java 2010-11-22
14:50:14 UTC (rev 13923)
@@ -1,22 +1,18 @@
package org.jboss.seam.example.spring;
-import javax.persistence.EntityManager;
+import java.util.List;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.orm.jpa.support.JpaDaoSupport;
import org.springframework.transaction.annotation.Transactional;
/**
* @author Mike Youngstrom
+ * @author Marek Novotny
*
*/
public class UserService extends JpaDaoSupport {
- //@PersistenceContext
- //@Autowired(required=true)
- //private EntityManager entityManager;
-
@Transactional
public boolean changePassword(String username, String oldPassword, String
newPassword) {
System.out.println("change password " + oldPassword + " to "
+ newPassword);
@@ -45,12 +41,15 @@
@Transactional
public User findUser(String username, String password) {
try {
- /*return (User)
- entityManager.createQuery("select u from User u where
u.username=:username and u.password=:password")
- .setParameter("username", username)
- .setParameter("password", password)
- .getSingleResult();*/
- return (User) getJpaTemplate().find("select u from User u where
u.username=?1 and u.password=?2", username, password).get(0);
+ List result = getJpaTemplate().find("select u from User u where
u.username=?1 and u.password=?2", username, password);
+ if (result.size() > 0)
+ {
+ return (User) result.get(0);
+ }
+ else
+ {
+ return null;
+ }
} catch (DataAccessException e) {
return null;
}