Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Postgres array support is limited to primitive data types and String, that is int[], long[], float[], double[], boolean[], String[]

This means For example, given a FragmentRepository method such as:

Code Block
languagejava
void deleteByAnchorIn(Collection<AnchorEntity> anchorEntities);

Changing to an array of AnchorEntity will not work. The following will not compilethrow an exception:

Code Block
languagejava
void deleteByAnchorIn(AnchorEntity[] anchorEntities);

Rather, the method would have to be changed to use anchor ID'sIDs:

Code Block
languagejava
void deleteByAnchorIdIn(int[] anchorIds);

Side note: in the above case, if using auto-generated SQL from the method name, the SQL generated using the anchor ID will be simpler than when using AnchorEntity objects, as Hibernate will generate a JOIN between FragmentEntity and AnchorEntity in the first case, but will only use FragmentEntity in the last case.

Advantage: Code already using Postgres arrays can be simplified

...