Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Gabo-gutierrez/Cinefinder/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Cinefinder uses a MySQL database namedCINES with a relational schema designed to manage movies, theatrical works, urban events, artists, categories, and their relationships.
Database Structure
The database consists of 6 main tables:- categorias - Content categories
- artistas - Artist information
- peliculas - Movie details
- obras - Theatrical works
- eventos_urbanos - Urban cultural events
- participaciones - Artist participation in events
Entity Relationship Diagram
Table Schemas
1. categorias
Stores content categories for movies, works, and events.| Column | Type | Constraints | Description |
|---|---|---|---|
id | BIGINT | PRIMARY KEY, AUTO_INCREMENT | Unique category identifier |
nombre | VARCHAR(100) | NOT NULL, UNIQUE | Category name |
- Acción (Action)
- Comedia (Comedy)
- Drama
- Terror (Horror)
- Ciencia Ficción (Science Fiction)
- Romance
- Documental (Documentary)
- Animación (Animation)
- Musical
- Thriller
- Fantasía (Fantasy)
- Aventura (Adventure)
Categorias - src/main/java/com/trainee/Cinefinder/model/Categorias.java:12
2. artistas
Stores artist information including actors, singers, dancers, magicians, and other performers.| Column | Type | Constraints | Description |
|---|---|---|---|
dni | BIGINT | PRIMARY KEY | National ID number (unique identifier) |
nombre | VARCHAR(70) | NOT NULL | Artist first name |
apellido | VARCHAR(70) | NULL | Artist last name (optional) |
tipo | VARCHAR(50) | - | Artist type (Actor, Cantante, Bailarina, etc.) |
descripcion | TEXT | - | Artist biography/description |
- Actor / Actriz (Actor/Actress)
- Cantante (Singer)
- Bailarina (Dancer)
- Mago (Magician)
- Rapero (Rapper)
- Pintora (Painter)
- Músico (Musician)
- Performista (Performance Artist)
Artistas - src/main/java/com/trainee/Cinefinder/model/Artistas.java:19
3. peliculas
Stores movie information.| Column | Type | Constraints | Description |
|---|---|---|---|
id | BIGINT | PRIMARY KEY, AUTO_INCREMENT | Unique movie identifier |
titulo | VARCHAR(200) | UNIQUE, NOT NULL | Movie title |
sipnosis | TEXT | - | Movie synopsis/summary |
duracion | INT | NOT NULL | Duration in minutes |
categoria_id | BIGINT | FOREIGN KEY → categorias(id) | Associated category |
categorias_fk_peliculas: Links tocategorias(id)ON DELETE CASCADE: Deleting a category deletes associated moviesON UPDATE CASCADE: Updating a category ID updates movie references
- El Último Viaje (120 min, Ciencia Ficción)
- Amor de Barrio (95 min, Romance)
- Ríe que Ríe (100 min, Comedia)
- Bajo Tierra (110 min, Thriller)
Peliculas - src/main/java/com/trainee/Cinefinder/model/Peliculas.java:13
4. obras
Stores theatrical works and stage performances.| Column | Type | Constraints | Description |
|---|---|---|---|
id | BIGINT | PRIMARY KEY, AUTO_INCREMENT | Unique work identifier |
titulo | VARCHAR(200) | NOT NULL | Work title |
descripcion | TEXT | - | Work description |
duracion | INT | NOT NULL | Duration in minutes |
categoria_id | BIGINT | FOREIGN KEY → categorias(id) | Associated category |
categorias_fk_obras: Links tocategorias(id)ON DELETE CASCADEON UPDATE CASCADE
- Voces Silenciadas (90 min, Drama)
- El Puente (95 min, Drama)
- Luz Roja (80 min, Musical)
- La Última Nota (100 min, Musical)
Obras - src/main/java/com/trainee/Cinefinder/model/Obras.java:13
5. eventos_urbanos
Stores urban cultural events like street performances, festivals, and public art exhibitions.| Column | Type | Constraints | Description |
|---|---|---|---|
id | BIGINT | PRIMARY KEY, AUTO_INCREMENT | Unique event identifier |
titulo | VARCHAR(200) | NOT NULL | Event title |
descripcion | TEXT | - | Event description |
fecha | DATE | NOT NULL | Event date |
lugar | VARCHAR(200) | NOT NULL | Event location |
categoria_id | BIGINT | FOREIGN KEY → categorias(id) | Associated category |
categoria_fk_eventos_urbanos: Links tocategorias(id)ON DELETE CASCADEON UPDATE CASCADE
- Festival de Callejeros (Plaza Bolívar, 2025-07-10)
- Noche de Freestyle (Parque de los Deseos, 2025-08-05)
- Arte al Paso (Calle 72, 2025-07-15)
- Mural Fest (Ciudad Salitre, 2025-07-12)
EventosUrbanos - src/main/java/com/trainee/Cinefinder/model/EventosUrbanos.java:15
6. participaciones
Links artists to movies, works, or events they participate in. This is a polymorphic relationship table.| Column | Type | Constraints | Description |
|---|---|---|---|
id | BIGINT | PRIMARY KEY, AUTO_INCREMENT | Unique participation identifier |
artista_dni | BIGINT | FOREIGN KEY → artistas(dni) | Artist’s DNI |
tipo_evento | ENUM | ’pelicula’, ‘obra’, ‘evento’ | Type of event |
evento_id | BIGINT | - | ID of the event (references peliculas, obras, or eventos_urbanos) |
artista_participaciones: Links toartistas(dni)ON DELETE CASCADE: Deleting an artist removes their participations
evento_id can reference:
peliculas.idwhentipo_evento = 'pelicula'obras.idwhentipo_evento = 'obra'eventos_urbanos.idwhentipo_evento = 'evento'
- Artist DNI 69374820 in pelicula ID 1
- Artist DNI 71592047 in pelicula ID 2
- Artist DNI 71920384 in evento ID 1
- Artist DNI 74718290 in obra ID 3
Participaciones - src/main/java/com/trainee/Cinefinder/model/Participaciones.java:16
Relationships
One-to-Many Relationships
categorias → peliculas
- Type: One-to-Many
- Description: One category can have many movies
- Foreign Key:
peliculas.categoria_id→categorias.id - Cascade: DELETE CASCADE, UPDATE CASCADE
categorias → obras
- Type: One-to-Many
- Description: One category can have many theatrical works
- Foreign Key:
obras.categoria_id→categorias.id - Cascade: DELETE CASCADE, UPDATE CASCADE
categorias → eventos_urbanos
- Type: One-to-Many
- Description: One category can have many urban events
- Foreign Key:
eventos_urbanos.categoria_id→categorias.id - Cascade: DELETE CASCADE, UPDATE CASCADE
artistas → participaciones
- Type: One-to-Many
- Description: One artist can participate in many events
- Foreign Key:
participaciones.artista_dni→artistas.dni - Cascade: DELETE CASCADE
Polymorphic Relationships
participaciones → peliculas/obras/eventos_urbanos
- Type: Polymorphic Many-to-One
- Description: A participation can reference a movie, work, or urban event
- Implementation:
tipo_eventoENUM determines the target tableevento_idstores the referenced ID
- Target Tables:
tipo_evento = 'pelicula'→peliculas.idtipo_evento = 'obra'→obras.idtipo_evento = 'evento'→eventos_urbanos.id
Indexes
Primary Keys (Automatically Indexed)
categorias.idartistas.dnipeliculas.idobras.ideventos_urbanos.idparticipaciones.id
Unique Constraints (Automatically Indexed)
categorias.nombrepeliculas.titulo
Foreign Key Indexes
MySQL automatically creates indexes on foreign key columns:peliculas.categoria_idobras.categoria_ideventos_urbanos.categoria_idparticipaciones.artista_dni
Constraints Summary
NOT NULL Constraints
- All primary keys
categorias.nombreartistas.nombrepeliculas.titulo,peliculas.duracionobras.titulo,obras.duracioneventos_urbanos.titulo,eventos_urbanos.fecha,eventos_urbanos.lugar
UNIQUE Constraints
categorias.nombre- Prevents duplicate category namespeliculas.titulo- Prevents duplicate movie titlesartistas.dni- Each artist has a unique national ID
CASCADE Behaviors
DELETE CASCADE:- Deleting a category deletes all associated movies, works, and events
- Deleting an artist deletes all their participations
- Updating a category ID updates all references in movies, works, and events
Database Initialization
The database includes sample data for:- 12 categories
- 12 artists
- 12 movies
- 12 theatrical works
- 12 urban events
- 12 artist participations
/workspace/source/BD_CINES.sql
JPA Mappings
The database schema is mapped to JPA entities using:@Entity- Marks the class as a JPA entity@Table- Specifies the table name@Id- Marks the primary key@GeneratedValue- Auto-increment strategy@Column- Maps to database columns@ManyToOne- Defines many-to-one relationships@JoinColumn- Specifies foreign key column
Best Practices
Use Transactions
Always use transactions when modifying multiple related records.
Validate Foreign Keys
Ensure referenced IDs exist before creating relationships.
Handle Cascades
Be aware of cascade delete behaviors when removing categories or artists.
Index Performance
The database is optimized with indexes on primary keys, unique columns, and foreign keys.
Next Steps
Architecture
Learn about the Spring Boot architecture and design patterns