Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

transient instance - save the transient instance before flushing

 
Ram Bu
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am getting the following error message when I try to update/add a new record in table A.

javax.servlet.ServletException: object references an unsaved transient instance - save the transient instance before flushing: com.company.struts.project.ParentClass

I have two tables TableA & TableB. The relationship is TableB 1->many TableA. The configuration files are set accordingly.

<!-- Table B config -->
<set name="TableB" inverse="false">
<key column="SId" />
<one-to-many entity-name="TableA" />
</set>

<!-- Table A config -->
<many-to-one name="TableB"
column="SId" not-null="false"
entity-name="TableA" />

So, whenever I try to update the SId column in Table A (nullable) to set to Null (this value in not in Table B, as it is primary key), the above error is being thrown.

I am sorry if I was incoherent in my explanation. Any help is greatly appreciated.
 
Amirtharaj Chinnaraj
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi ram

you try to use cascade attribute

or else call the DAOs (seperately)properly

the reason fo this problem is object is not send to persistence

state and you are flushing it before saving
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic