Reference‎ > ‎The recompute utility‎ > ‎

Running Recompute from the command line

From the command line with inline options

This is the quickest, but least flexible, way to run Recompute. You invoke it as follows:

java com.autobizlogic.recompute.Main <action> <hib-config-file> <output-file> <database-url> <logic-packages>

where the arguments are:

 action Required. Tells Recompute what to do. Can be scanplan or fix.
 hib-config-file Required. The path of the Hibernate configuration file.
 output-file Required. The path of the output file. The following expressions will be expanded:
  • %Y : current year (4 digits)
  • %M : current month (2 digits)
  • %D : current day of the month (2 digits)
  • %h : current hour (2 digits, 00-23)
  • %m : current minute (2 digits, 00-59)
  • %s : current second (2 digits, 00-59)
 database-url Optional (use - instead). The URL of the database. If - is specified instead, the URL will be obtained from the Hibernate configuration file.
 logic-packages Optional (use - instead). Comma-separated list of logic packages. Required if all your logic classes do not belong to the same package.

Note that you cannot set all possible options using this approach.

From the command line with a configuration file

It is often more convenient to specify all the parameters in a config file. This is a standard Java properties file, which means that anything after a hash mark is ignored, and you can continue a line on the next line with a backslash.

# Sample Recompute config, with all possible options

# What to do. Can be either scan, plan or fix
action = fix

# The location of a Hibernate configuration file
hibernate_config_file = c:/Users/jdoe/recompute/myapp.cfg.xml

# The name of a JPA unit. You can specify either hibernate_config_file or jpa_unit_name, but not both
# jpa_unit_name = MyApp

# This can be either xml, or sql, or the full name of a class implementing 
# the com.autobizlogic.recompute.format.ReportFormatter interface
output_formatter = xml

# The name of the output file. If none is specified, standard output is used.
# You can use the following variables in the file name:
# %Y : year (4 digits)
# %M : month (2 digits)
# %D : day of month (2 digits, 1-31)
# %h : hour (2 digits, 00-23)
# %m : minutes (2 digits, 00-59)
# %s : seconds (2 digits, 00-59)
output_file_name = c:/temp/RecomputeReport_%Y%M%D_%h%m%s.xml

# A final SQL command that should be issued after a fix.
# This is used for databases (such as Hypersonic) that require an orderly shutdown.
final_command = shutdown

# The full name of a class implementing the RecomputeListener interface
recompute_listener = com.acme.myapp.RecomputeListener

# A comma-separated list of packages containing the logic classes
logic_packages =, com.acme.myapp.customer.logic

# A comma-separated list of the entities to check. If this is specified, then only these entities
# will be checked. If this is not specified, then all the entities in the model will be checked.
# You can also specify a single attribute using the notation com.acme.Customer:balance
entities_to_check = com.acme.myapp.Customer, com.acme.myapp.Account, \

# A comma-separated list of the entities to *not* check. 
# Any entities specified here will be skipped.
entities_to_skip = com.acme.myapp.Product

# If you need to check only a subset of certain entities, you can enter qualifications here (at most
# one per entity). The format is:
# where_<entity-name> = <clause>
where_com.acme.myapp.Account = openDate > TO_DATE('31/07/2012', 'DD/MM/YYYY')
where_com.acme.myapp.Customer = name = 'Acme Ltd'

Once you have the config file, you can invoke Recompute as follows (assuming of course that all required classes are in the classpath):

java com.autobizlogic.recompute.Main <config-file>