When using H2 database getGeneratedKeys() simply returns a result-set with
generated keys. But it doesn't work with MySQL.

When using MySQL it is required to use Statement.RETURN_GENERATED_KEYS in
prepareStateement() to get generated keys. Otherwise it throws an
exception.

connection.prepareStatement(ApplicationMgtDBQueries.STORE_STEP_INFO,
Statement.RETURN_GENERATED_KEYS);

But when using Oracle that also doesn't works and it returns an empty
result set for getGeneratedKeys() method.

Using prepareStatement() as following was the only way that worked in both
MySQL, Oracle as well as in H2.

connection.prepareStatement(ApplicationMgtDBQueries.STORE_STEP_INFO, new
String[]{"ID"});

Just wondering whether this is the correct way to do it. Has anybody
experienced this before?

Related JIRA : https://wso2.org/jira/browse/IDENTITY-2140
                      https://wso2.org/jira/browse/IDENTITY-2097

-- 
Prasad Tissera
Software Engineer.
Mobile : +94777223444
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to