# # PROPERTIES FILE FOR SQL2JAVA # #---------------------------------------------- # (1/6) CONFIGURE YOUR DATABASE ACCESS #---------------------------------------------- jdbc.driver=org.hsqldb.jdbcDriver jdbc.url=jdbc:hsqldb:hsql://localhost jdbc.username=sa jdbc.password= jdbc.schema= #jdbc.driver=com.mysql.jdbc.Driver #jdbc.url=jdbc:mysql://localhost:3306/SQL2JAVA #jdbc.username=root #jdbc.password= #jdbc.schema=SQL2JAVA # jdbc.driver=oracle.jdbc.driver.OracleDriver # jdbc.url=jdbc:oracle:thin:@localhost:1521:ORADB # jdbc.username=sql2java # jdbc.password=sql2java # jdbc.schema=SQL2JAVA #------------------------------------------------- # (2/6) CONFIGURE RETRIEVAL OF AUTO GENERATED KEY #------------------------------------------------- # For those who do not want to read below, please simply pick up the # configuration associated with your database. # # More explanation: # When you save a bean whose primary key is numeric and has no value set, # we assume that you want sql2java to retrieve a key's value generated # on the database side. # # generatedkey.retrieve can take 4 values: # # auto - the standard approach when you have a JDBC 3.0 driver. # # before - the key's value is retrieved before inserting the record. # # after - the key's value is retrieved after inserting the record # # none - the key's value is never retrieved, frankly I doubt you # want this configuration # # If you set it to before or after you also need to configure the # autogeneratedkey.statement properties. # is replaced at code generation time by the table name. # You may adjust this properties to fit your own naming convention. # # PICK THE CONFIGURATION ASSOCIATED WITH YOUR DATABASE # (or create one, but in that case let us know so we can add it here... :-) # #-- HSQL ------ generatedkey.retrieve=after generatedkey.statement=CALL IDENTITY() #-- ORACLE 8i ------ #generatedkey.retrieve=before #generatedkey.statement=SELECT SEQ_
.nextval FROM DUAL # #-- IF YOU USE A JDBC 3.0 DRIVER (works with mysql, ORACLE 9, etc..) ------ #generatedkey.retrieve=auto #generatedkey.statement= # #-- MYSQL (without jdbc 3.0 driver) ------ #generatedkey.retrieve=after #generatedkey.statement=SELECT last_insert_id() # #-- SQL SERVER, SYBASE ------ #generatedkey.retrieve=after #generatedkey.statement=SELECT @@IDENTITY # #-- POSTGRESQL ------ #generatedkey.retrieve=before #generatedkey.statement=SELECT nextval('
_SEQ') # #-- INFORMIX ------ #generatedkey.retrieve=after #generatedkey.statement=SELECT dbinfo('sqlca.sqlerrd1') FROM
# #-- FIREBIRD ------ # - need to create "sequence" number table first "create generator SEQ_
" # - the 1 is how much to increment the sequence #generatedkey.retrieve=before #generatedkey.statement=SELECT GEN_ID(SEQ_
, 1) FROM RDB$DATABASE #---------------------------------------------- # (3/6) GENERATED SOURCE CODE #---------------------------------------------- # Package name for the generated source code mgrwriter.package=sql2java.sample.database # Destination of the generated source code (package hierarchy is preserved) mgrwriter.destdir =src/java # Property file to use when initializing Velocity #mgrwriter.velocityprops=somefile # templates (you can generate java files, jsp, etc...) mgrwriter.templates.loadingpath=.,doc/config/templates mgrwriter.templates.perschema=ManagerTemplate.vm mgrwriter.templates.pertable=xBeanTemplate.vm, xManagerTemplate.vm, xComparatorTemplate.vm, xListenerTemplate.vm # sets a prefix to prepend to all generated classes # useful if you are worried about namespace collision with reserved words # or java.lang classes mgrwriter.classprefix= #----------------------------------------------- # (4/6) JDBC TYPES Mapping #----------------------------------------------- # # jdbc DATE mapping can be: # java.sql.Date # java.util.Date jdbc2java.date=java.util.Date # jdbc TIME mapping can be: # java.sql.Time # java.util.Date jdbc2java.time=java.util.Date # jdbc TIMESTAMP mappning can be: # java.sql.Timestamp # java.util.Date jdbc2java.timestamp=java.util.Date #----------------------------------------------- # (5/6) FILTER OUT CERTAIN TABLES #----------------------------------------------- # # COMMA SEPARATED list of table types to be mapped # Commonly seen types are TABLE, VIEW, SYSTEM TABLE, SYNONYM jdbc.tabletypes=TABLE # Table name pattern of tables to be mapped to classes. # available wildcard: % # defaults to % # You can specify several patterns separated by commas. jdbc.tablenamepattern=% # SPACE SEPARATED list of tables to include or exclude. If you specify both, # the include list will take priority. If these fields are left commented out, # all tables in the specified schema will get mapped to classes #mgrwriter.include=Testing #mgrwriter.exclude= #----------------------------------------------- # (6/6) CONFIGURE OPTIMISTIC LOCK #----------------------------------------------- # optimisticlock.type can take 2 values: # none - the optimistic lock mechanism is disabled (default). # timestamp - the optimistic lock column contains the System.currentTimeMillis() value. # # optimisticlock.column takes the column name used by optimistic lock mechanism in your database. # If this column is not present in some table the optimistic lock is not applied there. # the column mapping can be java.lang.Long or java.lang.String. # (jdbc type size >= 13 characters) optimisticlock.type=timestamp optimisticlock.column=version_time