Hi,
while generating the sql2java-classes for a oracle db, I got some datatype mappings which seems strange to me, f.e. the java-type java.lang.Object is generated for the db-type NVARCHAR2 which should be mapped into a java.lang.String.
I'd like to configure the following mappings:
NUMBER(10,0) --> Long
NVARCHAR2 --> String
Where and how can I change the dataype mappings?
(I found the 3 examples for the DATE, TIME and TIMESTAMP mappings in the sql2java.properties, but can other types be mapped there too? How?)
By the way: I found, that the generation results in other datatype mappings if I choose a MySQL DB ...
greetings
thomas
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
a additional info:
it seems that sql2java don't knows the oracle datatype NVARCHAR2 wich results in the use of the mapping-rule for Types.OTHER (wich is java.lang.Object).
How can I make sql2java know the type NVARCHAR2?
grettings
thomas
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
My guess is that the whole mapping depends on the Java type returned by your driver. Did you try with the driver provided with your Oracle version? It seems to me that the classes12.jar distributed with sql2java is quite "obsolete" by now.
Regards,
Alain
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
As far as the mapping of the NUMBER(10,0) to Long is concerned, I think the current code would do it, as long as your driver is returning a NUMERIC or DECIMAL as type for the column.
Please try to get rid of the classes12.jar in the sql2java classpath and drop there your own driver for your version (not described in your post). The classes12.jar was the driver for Oracle 9i.
Regards,
Alain
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
while generating the sql2java-classes for a oracle db, I got some datatype mappings which seems strange to me, f.e. the java-type java.lang.Object is generated for the db-type NVARCHAR2 which should be mapped into a java.lang.String.
I'd like to configure the following mappings:
NUMBER(10,0) --> Long
NVARCHAR2 --> String
Where and how can I change the dataype mappings?
(I found the 3 examples for the DATE, TIME and TIMESTAMP mappings in the sql2java.properties, but can other types be mapped there too? How?)
By the way: I found, that the generation results in other datatype mappings if I choose a MySQL DB ...
greetings
thomas
Hi,
a additional info:
it seems that sql2java don't knows the oracle datatype NVARCHAR2 wich results in the use of the mapping-rule for Types.OTHER (wich is java.lang.Object).
How can I make sql2java know the type NVARCHAR2?
grettings
thomas
The mappings between SQL types and Java types are defined in the code of class Column where in internal (sql2java specific) mapping type is used.
sql2java/src/java/net/sourceforge/sql2java/Column.java
My guess is that the whole mapping depends on the Java type returned by your driver. Did you try with the driver provided with your Oracle version? It seems to me that the classes12.jar distributed with sql2java is quite "obsolete" by now.
Regards,
Alain
As far as the mapping of the NUMBER(10,0) to Long is concerned, I think the current code would do it, as long as your driver is returning a NUMERIC or DECIMAL as type for the column.
Please try to get rid of the classes12.jar in the sql2java classpath and drop there your own driver for your version (not described in your post). The classes12.jar was the driver for Oracle 9i.
Regards,
Alain