|
|
@ -7,7 +7,6 @@ import javax.persistence.EntityManager; |
|
|
|
import javax.persistence.EntityManagerFactory; |
|
|
|
import javax.persistence.EntityManagerFactory; |
|
|
|
import javax.persistence.Persistence; |
|
|
|
import javax.persistence.Persistence; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import mivan.model.User; |
|
|
|
import mivan.model.User; |
|
|
|
|
|
|
|
|
|
|
|
public class UserRepositoryImpl implements UserRepository { |
|
|
|
public class UserRepositoryImpl implements UserRepository { |
|
|
@ -64,8 +63,8 @@ public class UserRepositoryImpl implements UserRepository { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void updateUser(Long id, String firstname, String lastname, String city, String username, String email, |
|
|
|
public void updateUser(Long id, String firstname, String lastname, String city,String username, String email, String password) { |
|
|
|
String password) { |
|
|
|
final EntityManager entityManager = this.entityManagerFactory.createEntityManager(); |
|
|
|
final EntityManager entityManager = this.entityManagerFactory.createEntityManager(); |
|
|
|
try { |
|
|
|
try { |
|
|
|
if (!entityManager.getTransaction().isActive()) { |
|
|
|
if (!entityManager.getTransaction().isActive()) { |
|
|
@ -91,7 +90,8 @@ public class UserRepositoryImpl implements UserRepository { |
|
|
|
|
|
|
|
|
|
|
|
User user = null; |
|
|
|
User user = null; |
|
|
|
try { |
|
|
|
try { |
|
|
|
user = (User) entityManager.createQuery("FROM User u WHERE lower(u.username) = '" + username.toLowerCase() + "'") |
|
|
|
user = (User) entityManager |
|
|
|
|
|
|
|
.createQuery("FROM User u WHERE lower(u.username) = '" + username.toLowerCase() + "'") |
|
|
|
.getSingleResult(); |
|
|
|
.getSingleResult(); |
|
|
|
|
|
|
|
|
|
|
|
entityManager.close(); |
|
|
|
entityManager.close(); |
|
|
|