Hi Erdinc,
As far as I can tell, you executed the exercise as described.
1° the index on movie + person + role is unique on purpose, to prevent duplicate information to be added to the database, so that's fine.
2° in the 6.6 exercise, they just propose you have a screen on which you select a person and a role for a given movie, and execute the Create on PersonMovieRole.
So I think the error message you are getting is completely to be expected if you try to add the same person with the same role to the same movie. That's just the unique index kicking in to prevent duplicates. So can you maybe confirm this to us : the person and role you are trying to add to the movie, is already present in the database ?
I had a quick look further down the line in the next exercises, about validation, but didn't see anything they do in the exercises to amend this.
So I'll just give you the short here :
you'll learn about validations soon, and typically when there are constraints on the data (such as this unique index), there's a number of approaches :
1° prevent bad combinations to be selected (which would be a bit harder in this specific example)
2° perform validations to verify if it's not a bad combination before attempting the create
3° trying the create and in case of an exception trying to give a meaningfull message to the user
In my opinion, if at all possible options 1 and 2 should be used, 3 is a weak solution
So, in your particular example, in the Save action, you could execute an aggregate reading into the database with filter on movie + person + role, if found, then give user feedback that this has already been added, if not found, execute the create.
Hope this clarifies a bit, if not, more will become clear when you get to the tutorials on validations, but as far as I can see, you are not doing anything wrong so far.
Happy Coding,
Dorine