ORMUtil : formatSqlDate is hardcoded for Oracle database
Bug #493648 reported by
Olivier Chapiteau
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Global Health Observatory |
Fix Committed
|
Undecided
|
Unassigned |
Bug Description
The OrmUtil offer a service to format a date on database : formatSqlDate().
The problem is that ORMUtil is hardcoded to work on an Oracle database, causing a call to an Oracle only sql date format method :
private static int dbType = SQLUtil.
Can we change this harcoded setting to DB_TYPE_MYSQL ?
Changed in gho: | |
milestone: | none → data-loader-1.0 |
Changed in gho: | |
status: | New → Fix Committed |
To post a comment you must log in.
Yes, absolutely, the variable OrmUtil.dbType is static (application-wide) but modifiable (it is *NOT* coded as "static final"); the value DB_TYPE_ORACLE is only as the default. Any application using the ORM toolkit can set it to a database type actually used (currently limited to just Oracle and MySQL).
The standard way to do that is, at application start-up, call the method OrmUtil.setDbType. For example, see the following code snipped in FluID, method BusinessObjectD ispatcher. init(), which is called when the Web application is starting up in Tomcat:
private static synchronized void init() { setDbType( SQLUtil. DB_TYPE_ MYSQL); setSkipEmptyXml TagsFlag( true); setReleaseJdbcC onnectionEarly( true);
OrmUtil.
initializedFlag = true;
CommonDTO.
// SessionContext.
}