Kerb
Kerb

Reputation: 1168

JPA In expression: what is collection size limit?

I'd like to run a JPA query (eclipselink) like:

select t from SomeEntity t where t.branch.id in :branchList

and pass a collection as branchList.

The question is what is the collection size limit?

Upvotes: 3

Views: 1184

Answers (2)

Ondra Žižka
Ondra Žižka

Reputation: 46904

The limit is - practically - whatever fits in JVM Heap memory. Or, theoretically, whatever the collection can address, which is probably something like 2^32-1 or so 2^64-1 in 64-bit JVM. Just guessing.

If the question is "How to put a limit", then see JPA 2.0's Criteria API

Upvotes: 1

Mikko Maunu
Mikko Maunu

Reputation: 42114

JPA does not set strict limit. Upper limit depends about how many arguments IN clause in database can handle. For example with Oracle limit is 1000.

Upvotes: 5

Related Questions