> For the complete documentation index, see [llms.txt](https://bxorm.ortusbooks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://bxorm.ortusbooks.com/bxorm-2.x/modeling/type-conversion.md).

# Type Conversion

How BoxLang's dynamic types are bridged to JDBC column types

BoxLang is dynamically typed, but JDBC and Hibernate expect a specific Java type for every column. bx-orm bridges the two using a set of built-in JPA `AttributeConverter` classes, applied automatically based on each property's `ormType`.

## How It Works

When bx-orm generates the Hibernate mapping XML for a property, it normalizes the property's `ormType` value (folding aliases like `big_decimal`/`bigdecimal`, or `date`/`datetime`, down to a canonical name) and, for most properties, wires up a matching converter:

| `ormType` values (aliases folded)                    | Canonical type | Converter used                          |
| ---------------------------------------------------- | -------------- | --------------------------------------- |
| `string`, `varchar`, `nvarchar`                      | `string`       | `StringConverter`                       |
| `bigdecimal`, `big_decimal`, `big-decimal`           | `bigdecimal`   | `BigDecimalConverter`                   |
| `biginteger`, `big_integer`, `big-integer`, `bigint` | `biginteger`   | `BigIntegerConverter`                   |
| `integer`, `int`                                     | `integer`      | `IntegerConverter`                      |
| `long`                                               | `long`         | `LongConverter`                         |
| `tinyint`, `tinyinteger`                             | `short`        | `ShortConverter`                        |
| `numeric`, `number`, `decimal`                       | `double`       | `DoubleConverter`                       |
| `float`                                              | `float`        | `FloatConverter`                        |
| `bit`, `bool`                                        | `boolean`      | `BooleanConverter`                      |
| `yes-no`, `yesno`, `yes_no`                          | `yes_no`       | `BooleanConverter`                      |
| `true-false`, `truefalse`, `true_false`              | `true_false`   | `BooleanConverter`                      |
| `eurodate`, `usdate`, `date`, `datetime`             | `timestamp`    | `DateTimeConverter`                     |
| `time`                                               | `time`         | `TimeConverter`                         |
| `blob`, `byte[]`                                     | `binary`       | *(none - stored as raw binary)*         |
| `char`, `nchar`                                      | `character`    | *(none - stored as a single character)* |
| `clob`                                               | `text`         | *(none - stored as text)*               |

Each converter's job is to translate a BoxLang dynamic value into the JDBC type Hibernate expects on the way into the database, and back into a BoxLang-friendly value on the way out - using BoxLang's own type casters (e.g. `DateTimeCaster`, so a `DateTime` object round-trips correctly regardless of what dynamic type was assigned to the property in memory).

{% hint style="info" %}
**Identifier and version properties skip converters.** A property with `fieldtype="id"` or `fieldtype="version"` is written using its plain Hibernate basic type, not one of the converters above. This keeps primary key and optimistic-locking columns on Hibernate's native type handling.
{% endhint %}

## Custom Converters

There is currently no supported mechanism for registering your own `AttributeConverter` for a property - the converters above are applied automatically based on `ormType` and cover the standard Hibernate basic types. If you need a database column type not covered here, use `sqlType` to control the generated DDL, or reach for a [custom Hibernate config](/bxorm-2.x/getting-started/configuration/custom-hibernate-config.md) / `hibernateProperties` for engine-level tuning.

See [Properties](/bxorm-2.x/modeling/properties.md#orm-type) for the full list of `ormType` values you can set on a property.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://bxorm.ortusbooks.com/bxorm-2.x/modeling/type-conversion.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
