Better way to manage data integrity, without having too many composite FK's I have following tables:

class_table (class_id = Auto Incremented Primary Key (AIPK) of this table)
user_table (class_id, user_id (AIPK of this table))
course_table(class_id, course_id (AIPK of this table))

enrollment_table(class_id, user_id, course_id, enrollment_id (AIPK))


Now to maintain data integrity and make sure that both user_id and course_id belong to same class_id, I will have to create 2 composite Foreign Key's (FK) on enrollment_table e.g.

(class_id, user_id) to -&gt; user_table
(class_id, course_id) to -&gt; course_table


With this kind of schema design, if there are more tables involved then number of composite FK's are increasing. So I wanted to know if there is any better way of modeling this kind of schema and avoiding too many composite FK's.
Two composite FKs including the otherwise redundant column class_id are probably the most elegant and efficient solution to enforce that users can only enroll in courses of their class. I see no better alternative.