# Mapping a collection of embeddable with a JSON type

**URL:** <https://discourse.hibernate.org/t/mapping-a-collection-of-embeddable-with-a-json-type/9438>\
**Category:** Hibernate ORM\
**Created:** [April 30, 2024, 7:09am UTC](https://discourse.hibernate.org/t/mapping-a-collection-of-embeddable-with-a-json-type/9438 "2024-04-30T07:09:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![valzie](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/valzie/32/3172_2.png) [@valzie](https://discourse.hibernate.org/u/valzie)\
**Post date:** [April 30, 2024, 7:09am UTC](https://discourse.hibernate.org/t/mapping-a-collection-of-embeddable-with-a-json-type/9438/1 "2024-04-30T07:09:15Z")

</div>

Hi  
A similar question has already been asked, but I have a slightly different case where the embedded type is used not only in a collection but also as a separate field in the same or in other entity.

```auto
@Entity
class Test {
    @Embedded
    private Doc doc;

    @JdbcTypeCode(SqlTypes.JSON)
    private List<Doc> docs;

    ...
}

@Embeddable
class Doc {
    private String archiveNumber;
    private String archiveStatus;
    private ZonedDateTime archivedAt;
    private String details;
    ...
}

```

I am getting error:  
`org.hibernate.AnnotationException: Property '...Test.docs' is mapped as basic aggregate component array, but this is not yet supported.`

regards,  
Valdas

p.s. this is exception trace of my real app:

```auto
Expecting code not to raise a throwable but caught
  "org.hibernate.AnnotationException: Property 'lt.gama.model.sql.documents.EstimateSql.docs' is mapped as basic aggregate component array, but this is not yet supported.
	at org.hibernate.boot.model.internal.PropertyBinder.bindBasic(PropertyBinder.java:1068)
	at org.hibernate.boot.model.internal.PropertyBinder.bindProperty(PropertyBinder.java:890)
	at org.hibernate.boot.model.internal.PropertyBinder.buildProperty(PropertyBinder.java:788)
	at org.hibernate.boot.model.internal.PropertyBinder.processElementAnnotations(PropertyBinder.java:709)
	at org.hibernate.boot.model.internal.EntityBinder.processIdPropertiesIfNotAlready(EntityBinder.java:1041)
	at org.hibernate.boot.model.internal.EntityBinder.handleIdentifier(EntityBinder.java:357)
	at org.hibernate.boot.model.internal.EntityBinder.bindEntityClass(EntityBinder.java:237)
	at org.hibernate.boot.model.internal.AnnotationBinder.bindClass(AnnotationBinder.java:423)
	at org.hibernate.boot.model.source.internal.annotations.AnnotationMetadataSourceProcessorImpl.processEntityHierarchies(AnnotationMetadataSourceProcessorImpl.java:256)
	at org.hibernate.boot.model.process.spi.MetadataBuildingProcess$1.processEntityHierarchies(MetadataBuildingProcess.java:279)
	at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:322)
	at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:1432)
	at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1503)
	at org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:55)
	at jakarta.persistence.Persistence.createEntityManagerFactory(Persistence.java:80)
	at lt.gama.test.base.guice.TestJpaPersistService.start(TestJpaPersistService.java:92)

```

---

<div class="post-metadata">

**Author:** ![beikov](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/beikov/32/258_2.png) [@beikov](https://discourse.hibernate.org/u/beikov)\
**Post date:** [April 30, 2024, 12:21pm UTC](https://discourse.hibernate.org/t/mapping-a-collection-of-embeddable-with-a-json-type/9438/2 "2024-04-30T12:21:30Z")

</div>

Like the message says, this is not yet supported, but will hopefully be supported in 6.6 once [HHH-15862 Support basic array values in aggregate components by beikov · Pull Request #7577 · hibernate/hibernate-orm · GitHub](https://github.com/hibernate/hibernate-orm/pull/7577) is done.

In the meantime, remove the `@Embeddable` annotation from `Doc`.
