title: How can I add this value as a query, inside of a prepared statement?
body: <pre><code>Public void aMethod(String itemName, String theUsersName){  
  
  preparedStatement = conn.prepareStatement("INSERT INTO items  (Owner_ID, Name, State)               VALUES         (?,?,?) ");
  preparedStatement.setString(1, "(SELECT id FROM users WHERE username     = ' "+theUsersName+"')");
  preparedStatement.setString(2, itemName); 
  preparedStatement.setString(3, state);
  preparedStatement.executeUpdate();
  
  }
  </code></pre>
  
  <p>username table contains usernames and id's
  here I'm given theUsersName and want to find the id of that username, to set the Owner_ID of the new item in Item's table = theUsername's id.</p>