US 12,461,912 B2
Method and apparatus for mapping Java Streams to JPA commands
Per Ake Minborg, Stora Höga (SE); and Mislav Milicevic, Mostar (BA)
Assigned to Speedment AB, Stora Höga (SE)
Appl. No. 18/042,235
Filed by Speedment AB, Stora Höga (SE)
PCT Filed Aug. 20, 2021, PCT No. PCT/EP2021/073191
§ 371(c)(1), (2) Date Feb. 20, 2023,
PCT Pub. No. WO2022/038284, PCT Pub. Date Feb. 24, 2022.
Claims priority of provisional application 63/067,924, filed on Aug. 20, 2020.
Prior Publication US 2024/0020302 A1, Jan. 18, 2024
Int. Cl. G06F 7/00 (2006.01); G06F 8/51 (2018.01); G06F 16/242 (2019.01)
CPC G06F 16/2448 (2019.01) [G06F 8/51 (2013.01)] 10 Claims
OG exemplary drawing
 
1. A computer implemented method for efficient access to a database via a functional model-based procedure by seamlessly integrating Java Streams with database operations and directly mapping Java Streams to Java Persistence API, JPA, the JPA not being SQL, the method comprising:
generating by a processor: an initial builder corresponding to an original originating source, zero or more intermediate operations and a terminating operation;
storing in the memory, a sequence of operations;
translating the builder or parts of the builder to at least one operation using a JPA access language upon specifying the terminating operation;
the method further comprising optimization steps of:
reordering intermediate operations of same type while preserving Java Stream equivalence; or
squashing adjacent operations of the same type that preserve sequential operations: Order, Type, State, Side Effect, into one single equivalent operation; or
reordering intermediate operations that are of different types while still preserving a Java Stream equivalence; and
wherein if multiple intermediate operations of the same type are sequentially invoked, they are transformable into a singular operation.