0

I am trying to create an examination web app, in my app I have a JSF wizard that has 3 tabs, the first tab let the exam creator create a new exam for a course that is already defined or to choose from a predefined exams in a data-table.

Only after adding a new exam to a course the wizard will go to the next step automatically, to add questions.

When I try to add questions I get this error:

object references an unsaved transient instance
- save the transient instance before flushing

But it does not occur if I choose from the data-table an existing exam. When choosing an existing one it will go to the next tab and let me add a question and after doing so it will go to the next tab.

After researching I found out that I should change my managed bean scope from viewScope to applicationScope or sessionScope, I tried both and they did not work for me.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Khaled Jamal
  • 628
  • 1
  • 6
  • 18
  • @balusc Please note that Its not the same issue, that problem occurs using JPA and I am not using JPA – Khaled Jamal Mar 07 '17 at 11:07
  • It has fundamentally the same technical cause, regardless of whether you use plain ol' Hibernate or Hibernate JPA. You're attempting to merge an unsaved transient child/parent (i.e. it has no id/pk yet). This is illegal in any sane DB/ORM the world is aware of. It must be persisted first. This question is duplicated so many times already, see also the "related" column on right hand side, which was also shown to you after you entered the question's title. – BalusC Mar 07 '17 at 11:27

0 Answers0