create SP in sybase and call it from java by passing List<XModel> to it

64
June 21, 2022, at 04:10 AM

I have a pojo class XModel.java with fields -> f1, f2, f3, f4, f5, f6 all string and

Table XTable with fields ->

  • f1 varchar(20)
  • f2 varchar(20)
  • f3 varchar(20)
  • f4 varchar(100)
  • f5 varchar(20)
  • f6 varchar(20)

I have List of size 500 ( means list of 500 xmodel objects)

I need to pass this list to a SP which can insert/update all these 500 object into a table mentioned above in a single call.

one solution I tried is to make a SP which can take 1 single string with "|" separated values. This solution works but the issue is SP can take varchar upto 16000 long in my sybase version (15.7)

but from the above table you can figure out the size of string - (200 + 5) * 500 = 102,500

200 - total size of one xmodel object

5 - for pipe separator

example string - ABC..|EFG..|HIJ..|KLM..|NOP..|QRS..|TUV...|XYZ...|...

so I can't create SP with varchar(102,500) long. Instead of varchar I tried "text" but then it doesn't supports method like "right", "substring", "charindex" etc.. which I have used inside my SP

I tried creating SP with user_defined type or temp_table but don't have much hands-on calling these with java code.

using Java8 and sybase15.7

any help would be appreciated.

side note - If this can be done with ORM(hibernate) then I am ready to integrate it, but the database call should be single.

READ ALSO
Is there any way to inject Interceptor from external library in Spring?

Is there any way to inject Interceptor from external library in Spring?

I'm developing a jar library and trying to inject an interceptor from external jar library to Application

52
Clear/unset a system property maven.compiler.release so that is is no longer present

Clear/unset a system property maven.compiler.release so that is is no longer present

I have a project with complicated build setup (parent POM's with parent POM's) and so it happens that my compiler plugin executes with mavencompiler

47
Include project modules in a single jar

Include project modules in a single jar

I have a multi module maven project, the 3 modules are api, impl, allThe all module is a placeholder and has no source code, it only has a pom

32
Get process instance id for restarted process

Get process instance id for restarted process

I am using Camunda and I want to restart already completed processI am doing that using the following logic:

64