RE: reverse-Tool with Oracle 8.1.7
I fogot one line: int iDecimalDigits = rs.getInt("DECIMAL_DIGITS"); this comes before my other code: if(iDataType == java.sql.Types.DECIMAL){ if(iDecimalDigits>0) { iDataType = java.sql.Types.DOUBLE; } else { iDataType = java.sql.Types.BIGINT; } } Roland Ribi > -Original Message- > From: Ribi Roland [mailto:[EMAIL PROTECTED] > Sent: Wednesday, April 28, 2004 4:57 PM > To: 'OJB Users List' > Subject: RE: reverse-Tool with Oracle 8.1.7 > > > Hi > > I found the specific class and added the follwing code to the class > org.apache.ojb.tools.mapping.reversedb.DBSchema in the > read-method before > the call of this.addColumn(...): > > if(iDataType == java.sql.Types.DECIMAL){ > if(iDecimalDigits>0) { > iDataType = java.sql.Types.DOUBLE; > } else { > iDataType = java.sql.Types.BIGINT; > } > } > > It's a simple workaround, perhaps it helps to develope a better > revers-db-Tool in future... > > Roland Ribi > > > -Original Message- > > From: Ribi Roland [mailto:[EMAIL PROTECTED] > > Sent: Wednesday, April 28, 2004 2:19 PM > > To: '[EMAIL PROTECTED]' > > Subject: reverse-Tool with Oracle 8.1.7 > > > > > > Hi > > > > I would like to use the reverse-tool to genereate the > > repository.xml and the > > java code. > > > > But the reverse-tool takes always DECIMAL (JDBC-Type) and > > Long (Java-Type) > > for any Number column in Oracle. > > How can I override this so that a NUMBER(4) Column is mapped > > from BIGINT > > (JDBC-Type) to Long (Java) and a Column with NUMBER(6,2) is > > mapped from > > DOUBLE (JDBC-Type) to Double (Java)? > > > > Does I need to do this manually or can I declare the mapping in the > > OJB.properties or does I need to customize a class of OJB and > > if yes which > > one or how? > > > > With the default behavior I get ClasCastExceptions when I try > > to get any row > > from the database. > > > > Roland Ribi > > > > > > > > > - > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: reverse-Tool with Oracle 8.1.7
Hi I found the specific class and added the follwing code to the class org.apache.ojb.tools.mapping.reversedb.DBSchema in the read-method before the call of this.addColumn(...): if(iDataType == java.sql.Types.DECIMAL){ if(iDecimalDigits>0) { iDataType = java.sql.Types.DOUBLE; } else { iDataType = java.sql.Types.BIGINT; } } It's a simple workaround, perhaps it helps to develope a better revers-db-Tool in future... Roland Ribi > -Original Message- > From: Ribi Roland [mailto:[EMAIL PROTECTED] > Sent: Wednesday, April 28, 2004 2:19 PM > To: '[EMAIL PROTECTED]' > Subject: reverse-Tool with Oracle 8.1.7 > > > Hi > > I would like to use the reverse-tool to genereate the > repository.xml and the > java code. > > But the reverse-tool takes always DECIMAL (JDBC-Type) and > Long (Java-Type) > for any Number column in Oracle. > How can I override this so that a NUMBER(4) Column is mapped > from BIGINT > (JDBC-Type) to Long (Java) and a Column with NUMBER(6,2) is > mapped from > DOUBLE (JDBC-Type) to Double (Java)? > > Does I need to do this manually or can I declare the mapping in the > OJB.properties or does I need to customize a class of OJB and > if yes which > one or how? > > With the default behavior I get ClasCastExceptions when I try > to get any row > from the database. > > Roland Ribi > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
reverse-Tool with Oracle 8.1.7
Hi I would like to use the reverse-tool to genereate the repository.xml and the java code. But the reverse-tool takes always DECIMAL (JDBC-Type) and Long (Java-Type) for any Number column in Oracle. How can I override this so that a NUMBER(4) Column is mapped from BIGINT (JDBC-Type) to Long (Java) and a Column with NUMBER(6,2) is mapped from DOUBLE (JDBC-Type) to Double (Java)? Does I need to do this manually or can I declare the mapping in the OJB.properties or does I need to customize a class of OJB and if yes which one or how? With the default behavior I get ClasCastExceptions when I try to get any row from the database. Roland Ribi - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]