public static void editMedia(Media m){

	try {
		   if(conn == null || conn.isClosed()){
		    conn = DatabaseConnection.getConnection();
		   }
		  } catch (SQLException e1) {
		   // TODO Auto-generated catch block
		   e1.printStackTrace();
		  }
	
		try{
			conn.setAutoCommit(false);
			PreparedStatement stmnt = conn.prepareStatement("UPDATE Media set title = ?, creator = ?, producer = ?, place_of_publication = ?, year = ?, genre = ?, type = ? WHERE media_id = ?");
			stmnt.setString(1, m.getTitle());
			stmnt.setString(2, m.getCreator());
			stmnt.setString(3, m.getProducer());
			stmnt.setString(4, m.getPublicationPlace());
			stmnt.setString(5, StringDateSwitcher.dateToStringYear(m.getYearEdition()));
			stmnt.setString(6, m.getGenre());
			stmnt.setString(7, m.getType());
			stmnt.setInt(8, m.getMediaID());
			
			stmnt.execute();
			conn.commit();
			conn.setAutoCommit(true);
			
		}catch(SQLException e){
			e.printStackTrace();
			System.out.println("Media update fail: " + e);
		}
	}