src/data_layer/DBManager.java
public void insertNewTheatre(Theatre theatre) throws SQLException {
		PreparedStatement statement = conn.prepareStatement("INSERT INTO THEATRE(t_name,t_address) VALUES (?,?);");

		statement.setString(1, theatre.getName());
		statement.setString(2, theatre.getAddress());
		statement.execute();

		Statement state = conn.createStatement();
		ResultSet rs = state.executeQuery("SELECT LAST_INSERT_ROWID();");

		theatre.setTheatreID(rs.getInt(1)); // Set id of the newly inserted theatre
	}
/*
	 * Insert a new theatre to theatre table and set id for it.
	 */
Insert a new theatre to theatre table and set id for it.
Insert a new theatre to theatre table and set id for it .
public void insertNewTheatre(Theatre theatre) throws SQLException {
		PreparedStatement statement = conn.prepareStatement("INSERT INTO THEATRE(t_name,t_address) VALUES (?,?);");
		statement.setString(1, theatre.getName());
		statement.setString(2, theatre.getAddress());
		statement.execute();
		Statement state = conn.createStatement();
		ResultSet rs = state.executeQuery("SELECT LAST_INSERT_ROWID();");
		theatre.setTheatreID(rs.getInt(1)); 
	}
public void insertNewTheatre ( Theatre theatre ) throws SQLException { PreparedStatement statement = conn . prepareStatement ( "INSERT INTO THEATRE(t_name,t_address) VALUES (?,?);" ) ; statement . setString ( 1 , theatre . getName ( ) ) ; statement . setString ( 2 , theatre . getAddress ( ) ) ; statement . execute ( ) ; Statement state = conn . createStatement ( ) ; ResultSet rs = state . executeQuery ( "SELECT LAST_INSERT_ROWID();" ) ; theatre . setTheatreID ( rs . getInt ( 1 ) ) ; }
Insert a new theatre to theatre table and set id for it.
Insert a new theatre to theatre table and set id for it .
// Set id of the newly inserted theatre