-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ResultClassROF can fail to set fields/properties when JDBC driver returns unassignable type #457
Comments
Created pull request #458 |
Please provide a simple testcase that demonstrates the problem. Test suites need to be able to recreate such things. |
How can I write a test case that shows how Datanucleus fetch data from the database (in this case which ResultSet getter has been called)? I have problems with the mapping of SQL queries to ResultObjects (with Oracle 11g).
I have to add an setter with a BigDecimal parameter to my result class for all number fields (of type short, int, Integer, Long, ...). |
Using ResultSet.getInt()/getLong()/... hides a problem with setting the values in the result object fields. |
My test case can reproduce the problem but I was able to reproduce the problem with Oracle only. |
Thx. The testcase reproduces a problem using Junit on Oracle (11g) (no need for any "main"), due to how Oracle JDBC maps types |
TypeConversionHelper in more situations. Likely needs further tweaking. For #457
Suggest that you try with the change made above, since that is way simpler than your PR and works.for.me |
It looks like your commit solves the conversions problem for Oracle. Thx. My commit would be an additional enhancement for the way the data is fetched from the ResultSet. |
Marking as fixed, but retaining PR since would be nice to rework the whole class and could use as part of that |
Actually ResultClassROF.getResultObject() uses a getter specific to the resultClass (if resultClass is a simple class).
In all other cases ResultSet.getObject() will be called.
The Object got from getObject() needs to be converted afterwards to match the result class field.
Unfortunately the conversion works for the first row fetched only.
I have enhanced ResultClassROF to support ResultSet getters specific to the field classes.
I will try to create a pull request for it.
The text was updated successfully, but these errors were encountered: