Maybe I just can't see the wood because of the trees..but:
- I insert a problem, then I have to insert in the link table, in order to do that
I need both the ids(eventid,problemid). My problem is how to obtain the problemid.
Can you recommend a way to obtain this id(problemid) besides the one where I
select this ID from the problems table by extracting the last inserted row.
Joined: Oct 08, 2006
Oh, now I see, your actual problem is that you don't know how to obtain the generated key (the insert ID) from the statement?
If so, just use Statement#getGeneratedKeys() on the same statement directly after the executeUpdate(). It returns a ResultSet with the generated key in the 1st column of the 1st row.
Joined: Mar 11, 2009
that's it . Sorry for the confusion. Do you think that this can be done with a stored procedure?
Joined: Oct 13, 2005
"zup troll" please read the important administrative private message I am about to send you.