liveBook · Manning

CompositeUserType

As explained in Java Persistence with Spring Data and Hibernate epub

CompositeUserType is a Hibernate interface for mapping a composite value type with individually queryable properties.

CompositeUserType is Hibernate’s extension point for mapping a composite value as multiple individually queryable properties. A MonetaryAmount mapping can expose amount and currency, allowing queries such as select avg(i.buyNowPrice.amount) from Item i. section 6.3.3

Mapping two monetary prices

An Item can map buyNowPrice as USD and initialPrice as EUR, using distinct column pairs such as BUYNOWPRICE_AMOUNT and BUYNOWPRICE_CURRENCY. Tests verify values like 1.1 USD and 2.00 EUR.

How Java Persistence with Spring Data and Hibernate epub covers it

How deep it goes
Explains property exposure, parameterization, registration, and column mapping without detailing the complete interface contract.
Examples
Uses MonetaryAmount, USD and EUR conversion parameters, paired amount-and-currency columns, and assertions over mapped prices.
What you can do after
Build it from scratch as a parameterized Hibernate adapter for a composite value with separately mapped properties.
How it connects
Connects composite mapping with Hibernate UserType, DynamicParameterizedType, type definitions, and property-level column mappings.

This explainer was generated by Manning's knowledge graph from the text of Java Persistence with Spring Data and Hibernate epub. The section links point to the parts of the book it draws on.