jdbc foreign keys problem
Hello,
this is my code for an array in a database with 4 other arrays. C2J includes 3 fields: its id (primary key), idJava, idComponent...idJava and idComponent is from another 2 arrays from the DB.
public C2J(Statement statement) throws SQLException{
int up = statement.executeUpdate("INSERT INTO C2J (idJava,idComponent)"
+ "VALUES((SELECT idJava FROM JavaFiles),(SELECT idComponent FROM Components))");
}
I get an error that says:
Subquery returns more than 1 row
I tried using LIMIT 1 next to the ids (btw idJava and idComponent are foreign keys) but it doesn't really work right.
Any help?