the velocity templates are quite buggy, you will have to learn a little of velocity scripting and patch the scripts yourself (it is not that complicated)
I did it, however the velocity scripts we now use, contains several customisations for our project, so the object model is generated with several extra features that makes our velociy scripts no longer for general use, sorry.
How to customise the .vm scripts: download latest torque src release (yes the torque sources, not the OJB sources).
In directory (referring to torque 3.01) templates/ojb you will find all OJB related .vm scripts.
now make sure that the controlTemplate attribute in the build-torque.xml tasks is set to the right path.
So here a little analisys of your error log.
2003-09-20 11:28:04,859 - Trying to use logger class org.apache.velocity.runtime.log.AvalonLogSystem 2003-09-20 11:28:04,859 - Couldn't find class org.apache.velocity.runtime.log.AvalonLogSystem or necessary supporting classes in classpath. Exception : java.lang.NoClassDefFoundError: org/apache/log/format/Formatter 2003-09-20 11:28:04,859 - Trying to use logger class org.apache.velocity.runtime.log.SimpleLog4JLogSystem 2003-09-20 11:28:04,859 - Using logger class org.apache.velocity.runtime.log.SimpleLog4JLogSystem
This is nothing tragic, it seems that class org.apache.log.format.Formatter is not found and the SimpleLog4JLogSystem is used instead.
org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
2003-09-20 11:28:05,460 -
org.apache.velocity.runtime.exception.ReferenceException: reference :
template = ojb/repository/MainRepository.vm [line 16,column 15] :
$ojbPlatform is not a valid reference.
2003-09-20 11:28:05,460 -
org.apache.velocity.runtime.exception.ReferenceException: reference :
template = ojb/repository/MainRepository.vm [line 17,column 17] :
${jdbcLevel} is not a valid reference.
2003-09-20 11:28:05,460 -
org.apache.velocity.runtime.exception.ReferenceException: reference :
template = ojb/repository/MainRepository.vm [line 21,column 13] :
$databaseDriver is not a valid reference.
2003-09-20 11:28:05,460 -
org.apache.velocity.runtime.exception.ReferenceException: reference :
template = ojb/repository/MainRepository.vm [line 23,column 18] :
$database is not a valid reference.
2003-09-20 11:28:05,460 -
org.apache.velocity.runtime.exception.ReferenceException: reference :
template = ojb/repository/MainRepository.vm [line 24,column 14] :
$databaseName is not a valid reference.
2003-09-20 11:28:05,460 -
org.apache.velocity.runtime.exception.ReferenceException: reference :
template = ojb/repository/MainRepository.vm [line 26,column 15] :
$databaseUser is not a valid reference.
2003-09-20 11:28:05,520 - ResourceManager : found
ojb/repository/Repository.vm with loader
org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
2003-09-20 11:28:05,540 - Left side ($col.size) of '!=' operation has
null value. Operation not possible. ojb/repository/Repository.vm [line
62, column 24]
Several varibles are not found, try to use following mysql.profile.
since I did several changes to the .vm scripts, I don't know if all these variable are really needed for your requirements, but it may help...
//***************************
# ------------------------------------------------------------------- # T O R Q U E C O N F I G U R A T I O N F I L E # ------------------------------------------------------------------- torque.project = <prj_name>
# ------------------------------------------------------------------- # T A R G E T D A T A B A S E # axion, cloudscape, db2, db2400, hypersonic, interbase, mssql, # mysql, oracle, postgresql, sapdb, sybase # ------------------------------------------------------------------- torque.database = mysql
# -------------------------------------------------------------------
# D A T A B A S E S E T T I N G S
# -------------------------------------------------------------------
torque.database.driver= <your_db_driver>
torque.database.createUrl = <complete_conn_url>
torque.database.buildUrl = <complete_conn_url>
torque.database.url = <complete_conn_url>
torque.database.schema = ....
torque.database.user = ....
torque.database.password = ....
torque.database.host = ....
torque.sameJavaName = false
torque.schema.ojb.excludes = internal-schema.xml
torque.schema.dir = ${ojb.schemadir}
torque.ojb.dir = ${ojb.omdir}
torque.templatePath = ${torque.builddir}/templates#These values are needed by ojb/repository/Control.vm
ojbPlatform = MySQL
jdbcLevel = 2.0
urlProtocol = jdbc
urlSubprotocol = mysql
databaseName = <reduced_conn_url>
#Set this to true if using a DataSource
ojbUseJNDI = false
ojbJNDISource = <DS_JNDI_name>
ojbUseInterface = false
useAutoCommit = 2
jcdAlias = ${torque.project}_jcdAlias# -------------------------------------------------------------------
#
# O B J E C T M O D E L I N F O R M A T I O N
#
# -------------------------------------------------------------------
# These settings will allow you to customize the way your
# Peer-based object model is created.
# -------------------------------------------------------------------
# addGetByNameMethod
# If true, Torque adds methods to get database fields by name/position.
#
# addIntakeRetrievable
# If true, the data objects will implement Intake's Retrievable
# interface
#
# addSaveMethod
# If true, Torque adds tracking code to determine how to save objects.
#
# addTimeStamp
# If true, Torque true puts time stamps in generated om files.
#
# basePrefix
# A string to pre-pend to the file names of base data and peer objects.
#
# complexObjectModel
# If true, Torque generates data objects with collection support and
# methods to easily retreive foreign key relationships.
#
# targetPackage
# Sets the Java package the om files will generated to, e.g.
# "com.company.project.om".
#
# useClasspath
# If true, Torque will not look in the <code>templatePath</code> directory,
# for templates, but instead load them from the classpath, allowing you to
# use Torque without extracted it from the jar.
#
# useManagers
# If true, Torque will generate Manager classes that use JCS for caching.
# Still considered experimental.
# -------------------------------------------------------------------
torque.targetPackage = <your_target_package>
torque.addGetByNameMethod = true torque.addIntakeRetrievable = false torque.addSaveMethod = true torque.addTimeStamp = true torque.basePrefix = Base torque.complexObjectModel = true torque.useClasspath = false torque.useManagers = false
//********************************
bye danilo
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
