skip to Main Content

Triple nested JPA Entity to JSON – Spring Boot Project

So, I have 3 @Entity classes class Campaign { @Id private long campaignId; //Other fields @OneToMany(mappedBy = "campaign",cascade=CascadeType.ALL) private Set<Question> questions; } class Question { @Id private long questionId; //Other fields @OneToMany(mappedBy = "question",cascade=CascadeType.ALL) private Set<Choices> choices; @ManyToOne(fetch=FetchType.LAZY) @JoinColumn(name="CAMPAIGN_ID") private…

VIEW QUESTION

java.lang.NullPointerException: Cannot invoke "com.proj.my.repository.OrderRepository.save(Object)" because "this.orderRepository" is null – Mysql

I want to test my orderService, each order has x cartItems, each cartItem is a product. I managed to do some code, and thought I got it right, but encountered a problem : java.lang.NullPointerException: Cannot invoke "com.proj.my.repository.OrderRepository.save(Object)" because "this.orderRepository" is…

VIEW QUESTION

Entity not creating table in DB – Postgresql

I'm using Spring boot, and I Run this model. package com.example.demo.Models; import jakarta.persistence.*; @Entity @Table(name = "user") public class UserModel { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(unique = true, nullable = true) private Long id; private String name; private String email;…

VIEW QUESTION
Back To Top
Search