Spring MVC + Hibernate: id to load is required for loading

后端 未结 1 591
名媛妹妹
名媛妹妹 2021-01-07 20:33

This is such a noob question, I know and I apologize. I\'m trying to edit existing record with Hibernates session.merge() method and I get the following error:



        
相关标签:
1条回答
  • 2021-01-07 21:14

    The problem isn't with Hibernate. title.getTitleId() is null when you pass it to session.get(), and that's a problem with your web service/application.

    1. Your GET might not be providing the id in the model object
    2. Your client code (form, client app, ajax call, whatever it is) might not be retaining the ID between the GET and POST
    3. Your POST might not be providing the id in the model object.

    You can provide more details here, or ask a new question, if you're having difficulties retaining attributes across the web, rest or WS session.

    0 讨论(0)
提交回复
热议问题