# Spring JPA 3 typedef 被删除

**URL:** <https://www.isharkfly.com/t/spring-jpa-3-typedef/15811>\
**Category:** 程序语言\
**Tags:** java, spring\
**Created:** [May 30, 2024, 4:48am UTC](https://www.isharkfly.com/t/spring-jpa-3-typedef/15811 "2024-05-30T04:48:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![hex](https://www.isharkfly.com/user_avatar/www.isharkfly.com/hex/32/21953_2.png) [@hex](https://www.isharkfly.com/u/hex)\
**Post date:** [May 30, 2024, 4:48am UTC](https://www.isharkfly.com/t/spring-jpa-3-typedef/15811/1 "2024-05-30T04:48:48Z")

</div>

JPA 升级到 3 后，typedef 被删除了，已经不能使用了。

可以使用 `@Convert` 来替代使用。

如下面的的代码：

```java
@Converts({
        @Convert(attributeName = "string-array", converter = StringArrayType.class),
        @Convert(attributeName = "int-array", converter = IntArrayType.class),
        @Convert(attributeName = "json", converter = JsonStringType.class),
        @Convert(attributeName = "jsonb", converter = JsonBinaryType.class)

```

 ![2024-05-30_00-48-30](https://cdn.isharkfly.com/com-isharkfly-www/discourse-uploads/original/2X/0/04405ba46cdf44c5146cba4a4beaf611a8863f95.png)
