After adding spring connection with second database, I catched some errors

I updated some files to set up the connection with the MySQ database, after that the program won’t start. Full errors list: 2022-08-23 19:50:54.927 ERROR 25220 — [ restartedMain] j.LocalContainerEntityManagerFactoryBean : Failed to initialize JPA EntityManagerFactory: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.loader.MultipleBagFetchException: cannot simultaneously fetch multiple bags: [com.bn.market.entities.User.productList, com.bn.market.entities.User.roles] 2022-08-23… Read More After adding spring connection with second database, I catched some errors

Hibernate @Query throw syntax error at or near "."

I try to get field tags from the entity Article: @Getter @Setter @Entity @ToString @NoArgsConstructor @AllArgsConstructor @Table(name = "articles") public class Article { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @Embedded private Author author; @Column(unique = true) private String title; private String content; @ElementCollection(targetClass = String.class, fetch = FetchType.EAGER ) @CollectionTable(name = "tags", joinColumns =… Read More Hibernate @Query throw syntax error at or near "."

Class X cannot be cast to class Boolean (X is in unnamed module of loader 'app'; Boolean is in module java.base of loader 'bootstrap

I noticed that when others are getting this problem, it is because they are trying to cast objects. I am not trying to cast. Furthermore, I am trying to ask if an object exists in a data table using Spring Boot repository. The following issue is occurring: What is the issue exactly? The model: @Entity… Read More Class X cannot be cast to class Boolean (X is in unnamed module of loader 'app'; Boolean is in module java.base of loader 'bootstrap

Java can't upload file with @Pathvariable optional

I try to build a todoapp with the function to upload files. Now i want to can upload files on a task or simply upload files without tasks. For that i need the @PathVariable Annotation to be optional. This is my Controller: @PostMapping("/upload/{taskId}") private ResponseEntity<String> uploadFile(@CurrentUser UserPrincipal userPrincipal, @RequestParam("file") MultipartFile[] file, @PathVariable(required = false) String… Read More Java can't upload file with @Pathvariable optional