问题
I have a very long sql and it's size is more than 150000 byte . I tried run it in derby editor. When I want to run, editör throws this error
Java class file format limit(s) exceeded: method1:e1 code length (158045 > 65535) in generated class
Is there any way to increase this limit ?
ps: I don't want to divide code to a few pieces. And I don't want to use temporary table.
回答1:
This has been a problem for Derby over the years. See, for example, DERBY-176, DERBY-732, DERBY-766, and DERBY-1714 (there are more like these).
In all the cases that I'm familiar with, it has been possible to rewrite the SQL that the application issues in order to reduce it to a limit that the JVM can handle (this is more a Java limitation than a Derby limitation).
Are you able to share the SQL that generates this problem? Perhaps the community can suggest a better way to frame your SQL that doesn't generate such extensive bytecodes.
回答2:
Unfortunately, there is no way to increase this limit. See the relevant part of the JVM spec.
I would suggest that rather than hard-coding the SQL into the class, you read it in from a text-file either as a resource on the classpath, or in a known location on the filing-system.
If the Derby editor itself is generating the class, you may not be able to use the Derby editor with this particular query. It might be wise to rethink the query. I would have thought there might be a better way to write the query. It can't be very maintainable at that length!
回答3:
there is no way to increase this limit. So I used SQLite instead of Derby.
It's a in-memory database too. And it's default code limit is over 1000000 byte. Also you can change code limit over 1000000000 byte at compile time.
来源:https://stackoverflow.com/questions/20262884/class-file-format-limits-exceeded