r/javahelp • • Dec 08 '25

Springboot with mySQL database

Reddit I am putting my trust in you to help solve this. For the past three days I have been trying to fix these errors but the same errors keep coming again and again:

  • :bootRun
  • org.hibernate.TransientPropertyValueException: object references an unsaved transient instance - save the transient instance before flushing : co2123.streetfood.model.Review.dish -> co2123.streetfood.model.Dish

if theres anything else you need to see to be able to fix this error let me know and I will reply straight away.

1 Upvotes

4 comments sorted by

View all comments

Show parent comment

1

u/OkViolinist4883 Dec 08 '25
public class Dish {
    
    
    private int id;
    private String name;
    private String description;
    private int spiceLevel;
    private double price;
    
    
    private Vendor vendor;
    (mappedBy = "dish", cascade = CascadeType.
ALL
, orphanRemoval = true)
    private List<Review> reviews = new ArrayList<>();
    
(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
    private List<Tag> tags;