@@ -0,0 +1,2629 @@
+package com.vladmihalcea.book.hpjp.hibernate.type.array;%0A%0Aimport com.vladmihalcea.book.hpjp.hibernate.type.json.model.BaseEntity;%0Aimport com.vladmihalcea.book.hpjp.util.AbstractPostgreSQLIntegrationTest;%0Aimport com.vladmihalcea.book.hpjp.util.providers.DataSourceProvider;%0Aimport com.vladmihalcea.book.hpjp.util.providers.PostgreSQLDataSourceProvider;%0Aimport org.hibernate.annotations.Type;%0Aimport org.hibernate.annotations.TypeDef;%0Aimport org.junit.Test;%0A%0Aimport javax.persistence.*;%0A%0Aimport static org.junit.Assert.assertArrayEquals;%0A%0A/**%0A * @author Vlad Mihalcea%0A */%0Apublic class PostgreSQLArrayUnnestTest extends AbstractPostgreSQLIntegrationTest %7B%0A%0A    @Override%0A    protected Class%3C?%3E%5B%5D entities() %7B%0A        return new Class%3C?%3E%5B%5D%7B%0A            Event.class,%0A        %7D;%0A    %7D%0A%0A    @Override%0A    protected DataSourceProvider dataSourceProvider() %7B%0A        return new PostgreSQLDataSourceProvider() %7B%0A            @Override%0A            public String hibernateDialect() %7B%0A                return PostgreSQL95ArrayDialect.class.getName();%0A            %7D%0A        %7D;%0A    %7D%0A%0A    @Test%0A    public void test() %7B%0A        doInJPA(entityManager -%3E %7B%0A            entityManager.persist(%0A                new Event()%0A                    .setT1(new int%5B%5D%7B1, 3, 6%7D)%0A                    .setT2(new int%5B%5D%7B8, 9%7D)%0A            );%0A%0A            entityManager.persist(%0A                new Event()%0A                    .setT1(new int%5B%5D%7B1, 2%7D)%0A                    .setT2(new int%5B%5D%7B8%7D)%0A            );%0A%0A            entityManager.persist(%0A                new Event()%0A                    .setT1(new int%5B%5D%7B6%7D)%0A                    .setT2(new int%5B%5D%7B8, 1%7D)%0A            );%0A        %7D);%0A        //https://stackoverflow.com/questions/23863255/aggregation-to-calculate-number-of-each-tag-where-there-are-two-types-of-tags/23863831#23863831%0A        doInJPA(entityManager -%3E %7B%0A            Event event = entityManager.find(Event.class, 1L);%0A        %7D);%0A    %7D%0A%0A    @Entity(name = %22Event%22)%0A    @Table(name = %22event%22)%0A    @TypeDef(typeClass = IntArrayType.class, defaultForType = int%5B%5D.class)%0A    public static class Event %7B%0A%0A        @Id%0A        @GeneratedValue%0A        private Long id;%0A%0A        @Column(columnDefinition = %22integer%5B%5D%22)%0A        private int%5B%5D t1;%0A%0A        @Column(columnDefinition = %22integer%5B%5D%22)%0A        private int%5B%5D t2;%0A%0A        public int%5B%5D getT1() %7B%0A            return t1;%0A        %7D%0A%0A        public Event setT1(int%5B%5D t1) %7B%0A            this.t1 = t1;%0A            return this;%0A        %7D%0A%0A        public int%5B%5D getT2() %7B%0A            return t2;%0A        %7D%0A%0A        public Event setT2(int%5B%5D t2) %7B%0A            this.t2 = t2;%0A            return this;%0A        %7D%0A    %7D%0A%7D%0A

Add test for PostgreSQL unnest