0

In some SQL variants (notably Oracle), the number of parameters one can pass to an IN statement is limited. I.e. the following wouldn't work;

select * from molecules where id in (atom_1, atom_2, atom_3, ... atom_785534);

Multiple solutions have been suggested, including using a temporary table or split the parameters into smaller groups.

What is the optimal solution for an ORM, specifically Hibernate 5+? As far as I can tell, it's not possible to create a temporary table with Hibernate and looping through chunks is not ideal, particularly when you may have multiple lists of paramaters that run the risk of overflowing the limit.

Druckles
  • 3,161
  • 2
  • 41
  • 65
  • Does anything stop you from creating a permanent table and emptying it every time you're done using it? – Magisch Jul 04 '18 at 13:09
  • It's not particularly great to have a util table lying around for both encapsulation reasons and maintenance. Plus it's limited to only one list of parameters. – Druckles Jul 04 '18 at 13:20
  • You could easily extend that table with a paramType like column and use it to store an arbitrary amount of lists. But I see your point. Still it might be worth considering – Magisch Jul 04 '18 at 13:24

0 Answers0