One quick solution comes to mind. If you don't need to use the SQL generated by Torque, you can just define your NUMERIC(9) fields as INTEGER or BIGINT in the XML. This should generate get/set methods that for long instead of BigDecimal. JDBC (or maybe Village) will manage the conversion when it's stored in the database.
FWIW, it looks like the default for Oracle is to map INTEGER into NUMBER(10,0). If you want to change this mapping so that INTEGER will generate NUMBER(9,0), you will need to modify / subclass the PlatformOracleImpl class in the Generator code. Look at the PlatformFactory.getClassnameFor(String) method for details on how a "new" Platform implimentation can get used. > -----Original Message----- > From: Anas Mughal [mailto:[EMAIL PROTECTED] > Sent: Wednesday, October 24, 2007 11:19 AM > To: Apache Torque Users List > Subject: Change JDBC to Java map > > We have specified NUMERIC(9) as the JDBC type for our primary keys. > (Database is Oracle.) > > The generated Java code produces BigDecimal for the NUMERIC > types. I am wondering if there is a way to change the > generator to produce "long" > instead of BigDecimal. > > I have done this type of changes when I used Propel. (Propel > is the PHP port of Torque.) It was pretty simple changing > type maps in Propel. > > In TypeMap.java, I see the following maps: > > - jdbcToJavaObjectMap > - jdbcToJavaNativeMap > - jdbcToVillageMethodMap > - jdbcToPPMethodMap > - jdbcToTorqueTypeMap > > I am unsure which of the above I should change. Could someone > please guide me on what is the right way to enforce "long" on > the java-side for NUMERIC. > Would it be advised not to change the existing Torque behavior? > > Thank you very much. > -- > Anas Mughal > DukeCE Privacy Statement: Please be advised that this e-mail and any files transmitted with it are confidential communication or may otherwise be privileged or confidential and are intended solely for the individual or entity to whom they are addressed. If you are not the intended recipient you may not rely on the contents of this email or any attachments, and we ask that you please not read, copy or retransmit this communication, but reply to the sender and destroy the email, its contents, and all copies thereof immediately. Any unauthorized dissemination, distribution or copying of this communication is strictly prohibited. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
