Basic information about using Beigesoft™ software (libraries).

* This is probably a difficult article for IT beginners, especially the second part, so just take a glance and go to the next article.

Implementation of persistable models (that are stored in a database).

  • These are models such as an Invoice, a Customer, etc.

  • They are also called - entities.

There are two types of persistable models: shareable between databases and not.

Shareable between databases models.

Shareable models can be created in different databases. Then they can be shared (by explicit or implicit ID). There are two types of shareable models:

  1. Models with a non-autogenerated ID (with a globally recognized ID, e.g. a currency "USD" with the ID "840")

  2. Models with an autogenerated ID and an implicit born ID. They has a triple ID: an autogenerated integer ID in the current DB, ID of the database where the model was born, and the ID born in the case if it's a foreign model (it was born in other database). This is a more fast and cross platform alternative to the UUID.

For example a "Customer A" has a non-autogenerated ID (it is used a phone number as ID value). Models of type #1 can be created and used at the same time in different databases, there is no need to wait for importing such data from a main database. For entities like an Invoice and its lines you should use autogenerated ID with implicit born ID. Two different invoices can be created in different databases (e.g. Office A and Office B) and they can be imported into central database with no collision.

Example of models with non-autogenerated ID (globally recognized ID) in beige-blc.jar:

  • org.beigesoft.mdlp.Lng - Language, ID is String, e.g. "en" or "ru"

  • org.beigesoft.mdlp.CsvMth - CSV method, ID is Long

  • org.beigesoft.mdlp.CsvCl - CSV method's line, ID is Long

Any document and inventory item (product) in beige-acc.jar has an autogenerated ID with an implicit born ID. If you need to have the same products in different databases, then you have to wait for importing them from a main database.

Non-shareable between databases models.

They are created in only database. There is no need (usually) to export them into another database. They have simplest automatically generated integer ID. For example buyer's cart (and its lines) in a web-store database. It's created only in a web-store database, but it can be imported into an accounting database if there is the only web-store database, otherwise it will be collisions.

Basic Beige-ORM models.

Any database model must have an ID and a Version. A version is used for optimistic locking, sharing(replication) and tracking purposes. Any entity has also the "isNew" field to decide - "should it be inserted or updated". Base models implement (have) this things.

To make your model ready to use in Beige ORM, you should make it a child of (extend or implement):

  • org.beigesoft.mdl.IHasId - basic interface

  • org.beigesoft.mdl.AIdStr - abstract model with ID of type String

  • org.beigesoft.mdl.AIdLn - abstract model with non-autogenerated ID of type Long

  • org.beigesoft.mdl.AIdLnNm - abstract model with non-autogenerated ID of type Long that has Name

  • org.beigesoft.mdl.AOrId - abstract model with autogenerated ID with implicit born ID (for shareable between databases)

  • org.beigesoft.mdl.AOrIdNm - abstract model with autogenerated ID with implicit born ID (for shareable between databases)

  • org.beigesoft.mdl.AIdLna - abstract model with autogenerated ID of type Long (for non-shareable between databases)

  • ...

Owned lists (e.g. invoice lines) must implement/extend:

  • org.beigesoft.mdl.IOwned - basis interface

  • org.beigesoft.mdlp.IOwnedOr - interface for model with autogenerated ID with implicit born ID (for shareable between databases)

  • org.beigesoft.mdlp.IOwnedi - interface for model with non-autogenerated Long ID (for shareable between databases)

  • org.beigesoft.mdlp.IOwneda - interface for model with autogenerated ID (for non-shareable between databases)

Models with a composite (complex) ID.

Beige-ORM supports any complex ID. For example models from beige-acc.jar:

  • org.beigesoft.ws.mdlp.Deliv - Delivering method, has ID of type enumeration

  • org.beigesoft.ws.mdlp.Cart - has ID of type Buyer

  • org.beigesoft.acc.mdlp.WrhItm - item in warehouse with triple ID (Item, UOM, Warehouse place)