Hello,

I have Database from 7 Tables, every one have own PK, so i want to create another table which have also own PK and in addition to, another 7 FK, every FK have a reference to certain PK in the another tables.
Java Code:
 String createTable = "CREATE TABLE  eumonis.PowerPlant ("
               + "  plantId VARCHAR(25) PRIMARY KEY NOT NULL," 
               + "  manufacturerId VARCHAR(25) NOT NULL," 
               + "  distOpId VARCHAR(25) NOT NULL," 
               + "  TransOpId VARCHAR(25)  NOT NULL," 
               + "  LocationId VARCHAR(25)  NOT NULL," 
               + "  StateId VARCHAR(25) NOT NULL," 
               + "  LevelId VARCHAR(25) NOT NULL,"
               + "  SourceId VARCHAR(25) NOT NULL," 
               + "  FOREIGN KEY (manufacturerId) REFERENCES eumonis.Manufacturer(name),"
               + "  FOREIGN KEY (TransOpId) REFERENCES eumonis.TransmissionGridOperator(operatorId)," 
               + "  FOREIGN KEY (distOpId) REFERENCES eumonis.DistributionGridOperator(operatorId)" 
               + ")";
	   
	   /* 
	    String createTable = "CREATE TABLE  eumonis.Location( " 
        + " locationId int(50)  PRIMARY KEY AUTO_INCREMENT, "
        + " bundesland VARCHAR(25) NOT NULL," 
        + " ort VARCHAR(75) NOT NULL," 
        + " plz VARCHAR(25) NOT NULL,"
        + " strasse VARCHAR(255) NOT NULL)"; 
	    */	
		            
	   /* String createTable = "CREATE TABLE  eumonis.Manufacturer " 
		          + "(name VARCHAR(75) PRIMARY KEY NOT NULL)";*/
	  /* 
	   String createTable = "CREATE TABLE  eumonis.DistributionGridOperator " 
		          + "(operatorId VARCHAR(25)  PRIMARY KEY NOT NULL," +
		          		"name VARCHAR(75) NOT NULL)";
	   */
	   
	  /*   String createTable = "CREATE TABLE  eumonis.TransmissionGridOperator " 
		          + "(operatorId VARCHAR(25)  PRIMARY KEY NOT NULL," +
		          		"name VARCHAR(75) NOT NULL)";
	    */
		   
	   /*
	    	String createTable = "CREATE TABLE  eumonis.federalState " 
		          + "(stateId VARCHAR(8) PRIMARY KEY NOT NULL)";
	    */
	   
	  /* 
	   String createTable = "CREATE TABLE  eumonis.feedInLevel " 
		          + "(levelId VARCHAR(25) PRIMARY KEY NOT NULL)";
	   
	   
	   String createTable = "CREATE TABLE  eumonis.energySource " 
		          + "(sourceId VARCHAR(45) PRIMARY KEY NOT NULL)";
	  */
The Question now, how to add those valuse (primary keys) from all tables in eumonis.PowerPlant table as Foreign keys
Java Code:
String query = "insert into eumonis.PowerPlant values(?,?,?,?,?,?,?)";
	       PreparedStatement ps = null;
ps = con.prepareStatement(query);

	           Iterator<PowerPlant> it = dataHolder.iterator();
	           while (it.hasNext()){
	        	   PowerPlant obj = it.next();
//use ps to add the values of Foreign key from another tables