As you probably know, PostgreSQL allows columns of a table to be defined as variable-length multidimensional arrays. Arrays of any built-in or user-defined base type can be created.
Example from the PostgreSQL manual:
Code:
CREATE TABLE sal_emp (
name text,
pay_by_quarter integer[],
schedule text[][]
);
I have a class with a String[] property and, for performance reasons, I'd like to write a UserType to use the array type feature to save the String[], instead of using the normal mapping of the collection on a specific table..
I red the chapter 5.3 of The Book (Java Persistence with Hibernate) but I still do not understand how to write a CompositeUserType able to map a property to something that is not an Hibernate Type. I already used the UserType feature to define some custom mapping, but I was always able to define the
Code:
public Type[] getPropertyTypes()
as an array of standard Types, as Hibernate.STRING or Hibernate.SERIALIZABLE. What can I use if the target type is an array? It must be something that implemenets the nullsafeGet and nullsafeSet methods, otherwise I could not implements those methods in my UserType.
Any hint will be appreciated.
Ciao
Marco Pancotti