I would like to report a possible bug.

I have the following scenario:
- table "reciperows" contains product recipes
- table "orderrows" contains order rows
- a user selects a recipe, enters the amount of products, confirms
- the program must insert into the order rows table the appropriate amount 
of each component,
according to the recipe rows table

In manually entered SQL, it works fine like this:

INSERT INTO orderrows (order_id, article_id, assetcode, qttyordered, 
comment, car_number, trailer_number) 
SELECT 1, component_id, assetcode, (qtty * 5) totalqtty, '', '', '' FROM 
reciperows WHERE recipe_id = 2;

However, when invoked via JDBC, the process fails.
What is more peculiar, it fails silently, no exception thrown.

--------- partial code listing below -------

private static final String INSERT_ORDERED_ROWS_FROM_RECIPE_ROWS =
    "INSERT INTO orderrows (order_id, article_id, assetcode, qttyordered, " 
+
    "comment, car_number, trailer_number) " + 
    "SELECT ?, component_id, assetcode, (? * qtty) totalqtty, " +
    "'', '', '' FROM reciperows WHERE recipe_id = ?";


    private static PreparedStatement insertOrderedRowsFromRecipeRowsSt = 
null;


    public void insertOrderedRowsFromRecipeRows(int orderId, int recipeId, 
int qtty) {


    try {
    insertOrderedRowsFromRecipeRowsSt.setInt(1, orderId);
    insertOrderedRowsFromRecipeRowsSt.setInt(2, qtty);
    insertOrderedRowsFromRecipeRowsSt.setInt(3, recipeId);
    insertOrderedRowsFromRecipeRowsSt.execute();
    
    } catch (Exception e) {
    errorHandler("insertOrderedRowsFromRecipeRows() failed",e);
    } finally {
    // Nothing to be done
    }
    }

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

Reply via email to