aspose file tools*
The moose likes Java in General and the fly likes If condition not working in transaction Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "If condition not working in transaction" Watch "If condition not working in transaction" New topic
Author

If condition not working in transaction

shaf maff
Ranch Hand

Joined: Sep 07, 2008
Posts: 180
Hi Guys

take a look at the following code:

In the "Insert new Recipients" bit of the code I am trying to introduce an if statement which checks the size of recipientIds. It will run preparedstatement3 only if that list has atleast 1 value. Now, when I run it and I enter nothing for the recipients I expect it to insert the data into the other tables and skip the recipients table, but that isnt the case. See the error ouput below:


Does anyone know why this is happening ?






.>
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Your recipientIds collection looks like it contains invalid data, hence your foreign key constraint fails. How/when do you populate it?


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
shaf maff
Ranch Hand

Joined: Sep 07, 2008
Posts: 180
Thats the problem, it contains no data so it shouldn't execute that chunck of code.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Well clearly it does contain data. I'd check the code where its set. Stick in a break point and see whats happening.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: If condition not working in transaction
 
Similar Threads
Hibernate Composite keymapping
Max Open Cursor! Please Help.
Unable to create many-to-one mapping
Update inside Select statement
Connection and PreparedStatement Relation...??