Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

EclipseLink/Development/DBWS/RestfulComponent/UseCases

DBRS Use Cases

The DBRS utility starts by reading some initial configuration information:

prompt > DBRSBuilder [-builderFile {path to dbrsbuilder.properties}] -stageDir {path to stageDir}
         (if command-line arg -builderFile not present, default to look in current working directory)
prompt > DBRSBuilder running, connected to port 8884 ... Press <Return> to finish

dbrsbuilder.properties:

# builder properties
builder.port=8884
#builder.mode=production
builder.mode=test
builder.test.port=8885

# project properties
project.name=projectname
project.entities=employee, other entities ...

# database properties
db.driver=com.mysql.jdbc.Driver
db.url=jdbc:mysql://localhost:3306/db
db.user=user
db.pwd=password
db.platform=org.eclipse.persistence.platform.database.MySQLPlatform
logging.level=info

There are three scenarios to consider:

  1. (Existing Entities) the database contains the specified entities: the typical scenario where the Project's entities are exposed via a RESTful CRUD application.
  2. (Greenfield Entities) the database does not contain the specified entities: the so-called greenfield scenario where the Project's entities do not yet exist on the database.
  3. (JPA Meta-data) meta-data describing the specified entities is provided through an alternative mechanism: the scenario where the Project's entities are described via a JPA .orm file.

Existing Entities

The DBRS utility will login in to the database using the given database credentials and 'scrape' the meta-data for the employee table: column names and datatypes, PKs, foreign-key relationships, etc. If the table name does not match the entity name, the user may specify an alias:

# project properties
alias.employee.tablename=EMP

If the built-in pluralization does not generate acceptible URIs, the user can alias that as well - e.g. if the entity is person, the plural should be people, not persons:

# project properties
alias.person.plural=people

The DBRS utility builds an in-memory representation of the required meta-data for the employee entity to be mapped to the database via a JPA entity and mapped to any RESTful clients via JAXB (supporting both XML and JSON media representations). Initially the back-end generation will target EclipseLink JPA/JAXB + Jersey (1.9.1 at the time of this writing).

Greenfield Entities

TBD

JPA Meta-data

TBD

Back to the top