public class PersistenceFacadeImpl implements IPersistenceFacade {
private SessionFactory sessionFactory;
private Session session;
private UserDetailsDAO userDetails;
// Mit Instanz erlaubt? oder ohne?
public PersistenceFacadeImpl(SessionFactory sessionFactory, Session session) {
this.sessionFactory = sessionFactory;
this.session = session;
}
/**
* createUser(), in UserDetailsDAO?
*/
@Override
public void createUser(String surname, String name) {
UserDetails user = new UserDetails();
user.setName(name);
user.setSurname(surname);
session.save(user);
}
@Override
public void deleteUser(String surname, String name) {
//Find user with
query
//Delete user
//Respond to User if delete was successful
String queryString = "from UserDetails where surname:surname and name=:name";
Query query = session.createQuery(queryString);
List<UserDetails> result =
query.list();
UserDetails result2 = result.get(0);
userDetails.deleteUserDetails(result2);
}