Skip to content
Snippets Groups Projects
Commit 404019df authored by Thomas Mewily's avatar Thomas Mewily
Browse files

create delete user & prof

parent c2af6b9c
No related branches found
No related tags found
No related merge requests found
No preview for this file type
No preview for this file type
......@@ -45,6 +45,13 @@ public class ProfDAO extends _Generic<ProfEntity> {
@Override
public void delete(ProfEntity obj) {
// TODO !
try {
PreparedStatement stmt = this.connect.prepareStatement("DELETE FROM profs WHERE id = ?;");
stmt.setInt (1, obj.getId());
ResultSet rs = stmt.executeQuery() ;
} catch (SQLException e) {
e.printStackTrace();
}
return null;
}
}
......@@ -29,12 +29,28 @@ public class UserDAO extends _Generic<UserEntity> {
@Override
public UserEntity create(UserEntity obj) {
//TODO !
try {
PreparedStatement stmt = this.connect.prepareStatement("insert into users (id, firstName, lastName) values (?, ?, ?);");
int idx = 1;
stmt.setInt (idx++, obj.getId());
stmt.setString(idx++, obj.getFirstName());
stmt.setString(idx++, obj.getLastName());
ResultSet rs = stmt.executeQuery() ;
} catch (SQLException e) {
e.printStackTrace();
}
return null;
}
@Override
public void delete(UserEntity obj) {
//TODO !
try {
PreparedStatement stmt = this.connect.prepareStatement("DELETE FROM users WHERE id = ?;");
stmt.setInt (1, obj.getId());
ResultSet rs = stmt.executeQuery() ;
} catch (SQLException e) {
e.printStackTrace();
}
return null;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment