java - spring-data-jpa: ORA-01795: maximum number of expressions in a list is 1000 -


i'm using spring data jpa. want transactions of client.id's list<string> clientidlist. problem passing big list , ora-01795 error.

@query(value = "select transactrepviewmodel transactrepviewmodel a.clientid in (?1) , a.cldate between ?2 , ?3", nativequery = true)     list<transactrepviewmodel> findbyclientidlist(list<string> clientidlist, date startdate, date enddate) throws dataaccessexception; 

my client list comes table database via oracle , cannot think of way solve problem...

edit: list dynamic, can return different amounts of id's. cannot create additional tables in databases. have no such priviledges.

you can partition list of clientids list of 999 elements , make multiple calls db. can use apache commons listutils partitioning:

  list<transactrepviewmodel> result = new arraylist<transactrepviewmodel>();   final list<list<string>> partitions = listutils.partition(clientidlist, 999);   (list<string> partition : partitions) {      result.addall(yourrepo.findbyclientidlist(partition, startdate, enddate);)   } 

Comments

  1. Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a Java developer learn from Java Training in Chennai. or learn thru Java Online Training from India . Nowadays Java has tons of job opportunities on various vertical industry.

    ReplyDelete

Post a Comment

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -