06.02 - Resources

conf.dbunit

Category-name: conf.dbunit

What: 'conf.dbunit' is the category of a resource which role is to configure DbUnit transactions 

How to use it?


conf.dbunit.ppk

Category-name: conf.dbunit.ppk

What: 'conf.dbunit.ppk' is the category of a resource that represents a pseudo-primary key filter for DbUnit transactions. The file format is as follows: for each table, define a property with the name of the table. The value of the property is the comma-separated list of the names of the columns that make up the primary key.

Here is an example of definition file content

employee=employee_id
company=company_id
contract=contract_employee_id,contract_company_id

Why: Usually DbUnit reads directly from the database information about the tables it needs to know, including their primary keys. However some tables simply have no primary key, which can lead DbUnit to failures for a few operations. The 'conf.dbunit.ppk' is a way to provide DbUnit with these extra information.

Note: If a primary key exists whereas a pseudo primary key is defined, the pseudo primary key overrides the primary key.


dataset.dbunit

Category-name: dataset.dbunit

What: 'dataset.dbunit' is the category of a resource that represents a DbUnit DataSet.

How to use it?

filter.dbunit

Category-name: filter.dbunit

What: 'filter.dbunit' is the category of a resource that represents a Dbunit Filter. These filters are used in assertions for comparison between DbUnit datasets ('dataset.dbunit'). Their purpose is to exclude / include from the comparison some tables or some column if you need to narrow the scope of your assertion.

How to use it?

parameter.named.sql

Category-name: parameter.named.sql

What:
'parameter.named.sql' is the category of a resource that represents a map of parameters for parameterized sql queries using named parameters (see 'query.sql')

parameter.indexed.sql

Category-name: parameter.indexed.sql

What: parameter.indexed.sql is the category of a resource that represents a list of parameters for parameterized sql queries using positional parameters (see 'query.sql').

.

query.sql

Category-name: query.sql

What: 'query.sql' is the category of a resource that represents a query written in SQL. It can be parameterized either using named parameters or positional (indexed) parameters.

  • Named parameters: Usually a named parameter appears in a sql query as a column ':' followed by its name. For instance:
SELECT * FROM MY_TABLE WHERE id = :value;
with value: the name of the parameter

Since the parameters are identified by name, they can be passed in any order (they are matched by name).
  • Indexed parameters: Usually indexed parameters appear in a sql query as a question mark '?'. For instance:
SELECT * FROM MY_TABLE WHERE id = ?;
with '?': the indexed parameter

Since the parameters are identified by their position relative to each others, the order in which they are passed in does actually matter (they are matched by their position).

result.sql

Category-name: result.sql

What:
'result.sql' is the category of a resource that represents the result of a sql query (or 'query.sql' in TA).

script.sql

Category-name: script.sql

What: 'script.sql' is the category of a resource that represents a script written in SQL. They aren't meant to read data, rather to perform massive operations in bulk like insertion or manipulation of the structure of the database