~weird bug fixed: head->desk
Signed-off-by: Johannes Theiner <j.theiner@live.de>
This commit is contained in:
parent
d91e4ad5f1
commit
61e9b4df54
@ -448,7 +448,7 @@ public class Database {
|
|||||||
assert category != null;
|
assert category != null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
PreparedStatement statement = connection.prepareStatement("INSERT INTO " + book + "(isbn, title, description, " +
|
PreparedStatement statement = connection.prepareStatement("INSERT INTO book(isbn, title, description, " +
|
||||||
"price, year, publisher, category, image) VALUES (?, ?, ?, ?, ?, ?, ?, ?)", Statement.RETURN_GENERATED_KEYS);
|
"price, year, publisher, category, image) VALUES (?, ?, ?, ?, ?, ?, ?, ?)", Statement.RETURN_GENERATED_KEYS);
|
||||||
statement.setLong(1, book.getIsbn());
|
statement.setLong(1, book.getIsbn());
|
||||||
statement.setString(2, book.getTitle());
|
statement.setString(2, book.getTitle());
|
||||||
@ -466,15 +466,9 @@ public class Database {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (Author author : authors) {
|
for (Author author : authors) {
|
||||||
//FIXME: Prepared Statement is broken, parameters are null, but they are not
|
PreparedStatement authorStatement = connection.prepareStatement("INSERT INTO " + authorBook + " (author, book) VALUES (?, ?);");
|
||||||
String query = "INSERT INTO " + authorBook + " (author, book) VALUES (?, ?);";
|
authorStatement.setLong(1, author.getId());
|
||||||
String workingQuery = "INSERT INTO " + authorBook + " (author, book) VALUES (" + author.getId() + ", "+ lastId + ")";
|
authorStatement.setLong(2, lastId);
|
||||||
PreparedStatement authorStatement = connection.prepareStatement(workingQuery);
|
|
||||||
//statement.setLong(1, author.getId());
|
|
||||||
//statement.setLong(2, lastId);
|
|
||||||
System.out.println(authorStatement);
|
|
||||||
System.out.println(author.getId());
|
|
||||||
System.out.println(lastId);
|
|
||||||
insertCount += authorStatement.executeUpdate();
|
insertCount += authorStatement.executeUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user