bx-orm-type-conversion

Convert BoxLang dynamic objects to JDBC-compatible Java types via JPA AttributeConverters.

2|Updated Apr 11, 2024
One-click install
npx skills add https://github.com/ortus-boxlang/bx-orm --skill bx-orm-type-conversion
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: bx-orm-type-conversion
Source: https://github.com/ortus-boxlang/bx-orm/tree/main/.agents/skills-custom/bx-orm-type-conversion
Command: npx skills add https://github.com/ortus-boxlang/bx-orm --skill bx-orm-type-conversion

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill resolves the impedance mismatch between BoxLang's dynamic type system and the static requirements of Hibernate/JDBC, ensuring seamless data persistence and retrieval.

Core Features & Use Cases

  • Automated Type Mapping: Provides JPA AttributeConverters for standard types like Boolean, DateTime, and numeric formats.
  • Custom Converter Creation: Offers a template for implementing specialized converters for complex types like JSON or UUIDs.
  • Use Case: When you need to persist a BoxLang struct as a JSON string in a database column, use this Skill to implement and register a custom converter that handles the serialization and deserialization automatically.

Quick Start

Use the bx-orm-type-conversion skill to generate a custom JPA AttributeConverter for a new data type in your BoxLang ORM project.

Frequently Asked Questions about bx-orm-type-conversion

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I persist dynamic BoxLang types to a database using Hibernate?

You persist dynamic BoxLang types to a database by using JPA AttributeConverters to bridge BoxLang objects into static JDBC-compatible Java types required by Hibernate. This ensures seamless data persistence and retrieval without impedance mismatch.

What is the best way to map a BoxLang struct to a JSON database column?

The best way to map a BoxLang struct to a JSON column is to implement a custom JPA AttributeConverter that handles the serialization and deserialization automatically. This Skill provides templates for creating and registering these specialized converters within your ORM configuration.

Does BoxLang ORM support automatic type conversion for JPA entity mapping?

Yes, BoxLang ORM supports automatic type conversion for JPA entity mapping by providing programmatic registration of AttributeConverters. This handles bidirectional coercion for standard types like Boolean, DateTime, and numeric formats directly within the ORM configuration layer.

How do I register a custom JPA AttributeConverter in a BoxLang ORM project?

You register a custom JPA AttributeConverter in a BoxLang ORM project by using this Skill to generate the converter template and then programmatically applying it within the BoxLang ORM configuration layer to satisfy the technical requirement for database persistence.

Why do I need type conversion between BoxLang objects and JDBC types?

Type conversion between BoxLang objects and JDBC types is needed to resolve the impedance mismatch between BoxLang's dynamic type system and the static type requirements of Hibernate and JDBC, ensuring database operations do not fail due to type coercion errors.