Select max id and calling method from another class
posted 9 years ago
I have a method that has a prepared statement that executes before a SQL select max id query. The Prepared statement works great where I call it in another method in my Java Helper Class file.
Now I want to move the method with the prepared statement into another class and call in in my Java Helper Class.
For some reason it didnt work. Here is what it looked like with both methods in one class and everything working great with my Access 2003 database where the prepared statement runs and then I get the max id from the table:
Now if I put the insertData method in another class and call it in the HelperDB class it will correctly insert data into tableone but it doesnt retrieve the correct max tableoneid value.
It seems like the the object new AnotherHelper().insertData(user) runs after the select max sql statement (select max(tableoneId) from tableone) because I always get the second to last max value from tableone. Please advise. [ October 02, 2007: Message edited by: Joseph Smithern ]