/**
	  * Actualitza l'objecte serialitzat (scorm_structure) de 
	  * l'usuari amb l'identificador indicat.
	  * 
	  * Nota! Fa un update, per tant ha d'existir l'usuari!
	  * 
	  * @param courseStudentName : El nom de la taula en que ho guardem.
	  * @param studentId : L'identificador de l'usuari.(int Type) 
	  * @param object : Retornarà l'UserObjective, caldrà fer un cast.
	  * @return int Type: Retornarà l'identificador del resultset.
	  * @throws Exception : Llança una excepció si hi ha un error.
	  */
	private int writeJavaObject(
			final String courseStudentName,
			final int studentId,
			final Object object) 
	 throws Exception {		
		String sqlUpdateScormStructure =
			"UPDATE " + courseStudentName
			+ " set scorm_structure = ? WHERE student_id = ?";
                /** We already have
                  * private Connection conn = DriverManager.getConnection(url, userName, password);
                  */
		PreparedStatement pstmt =
			conn.prepareStatement(sqlUpdateScormStructure);
		
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		ObjectOutputStream oout = new ObjectOutputStream(baos);
		oout.writeObject(object); //serializing
		    
		// set input parameters
		pstmt.setBytes(1, baos.toByteArray());		    
		pstmt.setInt(2, studentId);
		pstmt.executeUpdate();

		// get the generated key for the id
		ResultSet rs = pstmt.getGeneratedKeys();
		int id = -1;
		if (rs.next()) {
			id = rs.getInt(1);
		}
		
		rs.close();
		pstmt.close();
		return id;
	}