Is it possible to work with PostgreSQL arrays using HQL?
<p>I've read a lot of topics dedicated to working with PostgreSQL arrays in Hibernate.
I implemented <code>UserType</code> interface and my queries are working perfectly fine with native sql.</p>

<pre><code>private void addCountry(String country, String[] cities) {
    Session session = HibernateUtil.getSessionFactory().getCurrentSession();
    session.beginTransaction();

    Query insert = session.createNativeQuery("INSERT INTO public.\"countries\"(\n" +
            "\t\"country\", \"cities\")\n" +
            "\tVALUES (:Country, :Cities);");
    Type arrayType = new CustomType(new StringUserType());
    insert.setParameter("Country", country);
    insert.setParameter("Cities", cities, arrayType);

    insert.executeUpdate();
    /**
    CountriesEntity countriesEntity = new CountriesEntity();
    countriesEntity.setCountry(country);
    countriesEntity.setCities(cities);
    session.save(countriesEntity);
     */
    session.getTransaction().commit();
}

private List&lt;String[]&gt; listCities() {
    Session session = HibernateUtil.getSessionFactory().getCurrentSession();
    session.beginTransaction();
    Query getCities = session.createNativeQuery("SELECT \"cities\"\n" +
            "\tFROM public.\"countries\";")
            .addScalar("cities", new CustomType(new StringUserType()));

    List&lt;String[]&gt; cities = getCities.list();
    session.getTransaction().commit();
    return cities;
}
</code></pre>

<p>Entity class: </p>

<pre><code>@Entity
@Table(name = "countries", schema = "public", catalog = "Travel_Agency")
public class CountriesEntity {
private String country;
private String[] cities;

@Id
@Column(name = "country")
public String getCountry() {
    return country;
}

public void setCountry(String country) {
    this.country = country;
}


@Column(name = "cities")
@Type(type = "com.testHibernate.core.StringUserType")
public String[] getCities() {
    return cities;
}

public void setCity(String[] cities) {
    this.cities = cities;
}
</code></pre>

<p>}</p>

<p>So, is it possible to do that using only HQL?</p>