Author | Message |
---|---|
jadiagaurang
Posts: 53
|
Posted 20:04 May 18, 2009 |
Hello All, I am trying to attach files with blogentry. It is running fine if I don't add files as attachments. I know that problem is at fileDao.saveFile( file ); and I guess it is because of Hibernate: select nextval ('hibernate_sequence'). Hibernate is trying to save file but it got some error during that save transaction. I have one method called processAttachments in createBlogEntryController.java, it got whole code from AbstractMessageController.java and modified according to my BlogEntryController requirement. I tried to debug a lot and I have attached one screenshot when excution reach at fileDao.saveFile( file ); line. You can see that file variable in watch window. I have attached several other screenshots and log files. I have spent my whole day to solve this error. Help me out... |
jadiagaurang
Posts: 53
|
Posted 00:18 May 19, 2009 |
I am still trying to understand this hibernate error. If some online forum post are true then this error is because of the default behavior of hibernate to the relations between objects. If you do not specify the cascade type in the hbm.xml file, then hibernate acts like it is a null relation which means the related object is already in the database. Now, File.hbm.xml does not have any cascade type so, I don't think that I need to change it. I already have cascade="save-update" in my BlogEntry.hbm.xml. I can not understand what is wrong with my code. Any suggestions... |
cysun
Posts: 2935
|
Posted 08:46 May 19, 2009 |
As far as I can see, the file attachment processing part of the code is fine. Maybe your blog entry references some other unsaved object? |