Skip to content

Commit 52e66cd

Browse files
committed
Add protected constructors to Movie nested classes and clean up record style
Restore @AllArgsConstructor/@NoArgsConstructor(access = PROTECTED) on Awards, Imdb, Tomatoes, Viewer, and Critic so Spring Data MongoDB can reliably instantiate them without depending on compiler debug info. Normalise record declaration spacing and replace FQN java.util.List with an import in VectorSearchResult.
1 parent 88090fd commit 52e66cd

4 files changed

Lines changed: 25 additions & 14 deletions

File tree

mflix/server/java-spring/src/main/java/com/mongodb/samplemflix/model/Movie.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,8 @@ private Fields() {
191191
@Getter
192192
@Setter
193193
@Builder
194+
@AllArgsConstructor(access = AccessLevel.PROTECTED) // needed for Spring Data and MongoDB mapping
195+
@NoArgsConstructor(access = AccessLevel.PROTECTED) // needed for Spring Data and MongoDB mapping
194196
public static class Awards {
195197
/**
196198
* Number of awards won.
@@ -214,6 +216,8 @@ public static class Awards {
214216
@Getter
215217
@Setter
216218
@Builder
219+
@AllArgsConstructor(access = AccessLevel.PROTECTED) // needed for Spring Data and MongoDB mapping
220+
@NoArgsConstructor(access = AccessLevel.PROTECTED) // needed for Spring Data and MongoDB mapping
217221
public static class Imdb {
218222
/**
219223
* IMDB rating (0.0 to 10.0).
@@ -237,6 +241,8 @@ public static class Imdb {
237241
@Getter
238242
@Setter
239243
@Builder
244+
@AllArgsConstructor(access = AccessLevel.PROTECTED) // needed for Spring Data and MongoDB mapping
245+
@NoArgsConstructor(access = AccessLevel.PROTECTED) // needed for Spring Data and MongoDB mapping
240246
public static class Tomatoes {
241247
/**
242248
* Viewer ratings information.
@@ -274,6 +280,8 @@ public static class Tomatoes {
274280
@Getter
275281
@Setter
276282
@Builder
283+
@AllArgsConstructor(access = AccessLevel.PROTECTED) // needed for Spring Data and MongoDB mapping
284+
@NoArgsConstructor(access = AccessLevel.PROTECTED) // needed for Spring Data and MongoDB mapping
277285
public static class Viewer {
278286
/**
279287
* Viewer rating (0.0 to 5.0).
@@ -297,6 +305,8 @@ public static class Viewer {
297305
@Getter
298306
@Setter
299307
@Builder
308+
@AllArgsConstructor(access = AccessLevel.PROTECTED) // needed for Spring Data and MongoDB mapping
309+
@NoArgsConstructor(access = AccessLevel.PROTECTED) // needed for Spring Data and MongoDB mapping
300310
public static class Critic {
301311
/**
302312
* Critic rating (0.0 to 5.0).

mflix/server/java-spring/src/main/java/com/mongodb/samplemflix/model/dto/BatchUpdateResponse.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
/**
44
* Response DTO for batch update operations.
55
*/
6-
public record BatchUpdateResponse(
6+
public record BatchUpdateResponse (
77
long matchedCount,
88
long modifiedCount) {}

mflix/server/java-spring/src/main/java/com/mongodb/samplemflix/model/dto/MovieSearchQuery.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* It supports full-text search, filtering by genre/year/rating, sorting, and pagination.
1010
*/
1111
@Builder
12-
public record MovieSearchQuery(
12+
public record MovieSearchQuery (
1313

1414
/**
1515
* Full-text search query.

mflix/server/java-spring/src/main/java/com/mongodb/samplemflix/model/dto/VectorSearchResult.java

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.mongodb.samplemflix.model.dto;
22

3+
import java.util.List;
34
import lombok.Builder;
45

56
/**
@@ -10,47 +11,47 @@
1011
*/
1112
@Builder
1213
public record VectorSearchResult (
13-
14+
1415
/**
1516
* Movie ObjectId as a string.
1617
*/
1718
String id,
18-
19+
1920
/**
2021
* Movie title.
2122
*/
2223
String title,
23-
24+
2425
/**
2526
* Movie plot summary.
2627
*/
2728
String plot,
28-
29+
2930
/**
3031
* Movie poster URL.
3132
*/
3233
String poster,
33-
34+
3435
/**
3536
* Movie release year.
3637
*/
3738
Integer year,
38-
39+
3940
/**
4041
* Movie genres.
4142
*/
42-
java.util.List<String> genres,
43-
43+
List<String> genres,
44+
4445
/**
4546
* Movie directors.
4647
*/
47-
java.util.List<String> directors,
48-
48+
List<String> directors,
49+
4950
/**
5051
* Movie cast members.
5152
*/
52-
java.util.List<String> cast,
53-
53+
List<String> cast,
54+
5455
/**
5556
* Vector search similarity score (0.0 to 1.0, higher = more similar).
5657
*/

0 commit comments

Comments
 (0)