IP Library › Granted Patent US 12,461,912
Granted Patent B2
US 12,461,912 · App. 18/042,235 · Granted Nov 4, 2025

Method and apparatus for mapping Java Streams to JPA commands

Inventors: Per Ake Minborg (Stora Höga, SE); Mislav Milicevic (Mostar, BA)
Assignee: Speedment AB
G06F16/2448G06F8/51
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 12,461,912
App. No.
18/042,235
Granted
Nov 4, 2025
Kind
B2
Abstract

The invention relates to a computer implemented method for efficient access to a database via a functional model-based procedure by translating a sequence of operations that are stored in a memory and that is described in the procedure that is specified using a generalized programming language into an intermediate database abstraction layer access language, whereby the intermediate data abstraction layer not being SQL. The method comprises: 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, the sequence of operations, and translating the builder or parts of the builder is translated to at least one operation using the intermediate database abstraction layer access language upon specifying the terminating operation.

Claims (18)

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.

2 . The method of claim 1 , comprising optimizing the initial builder before being rendered to JPA, wherein the optimization comprises reordering intermediate operations of different types while still preserving Java Stream equivalence.

3 . The method of claim 2 , wherein the intermediate operation and terminal operation are re-ordered, removed, added and/or replaced.

4 . The method of claim 2 , wherein a terminal operation is replaced by another terminal operation, a terminal operation is updated or wherein a terminal operator is replaced or updated in conjunction with modifying the list of intermediate operations to form an equivalent builder.

5 . The method according to claim 1 , if an intermediate operation is not translatable, the method further comprising moving the un-translatable operation further down the order in the builder and translating the translatable operation using the intermediate database abstraction layer language and subsequently applying the un-translatable operation on a resulting database object obtained from the translatable operation.

6 . The method according to claim 1 , further comprising subsequently rendering an intermediate operation is a “flatMap” operation to the JPA that reduces using one or more sub-queries.

7 . The method according to claim 1 , further comprising translating summarizing terminating operations to the JPA reducing the amount of data being transferred from the database.

8 . The method of claim 7 , wherein the terminating operation is one or several of sum, min, max, average and summaryStatistics.

9 . The method according to claim 1 , wherein the builder takes the shape of a java.util.Stream object.

10 . A system comprising at least one processing unit and at least one memory, the system configured to execute a method according to claim 1 .

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded May 19, 2023
From: MINBORG, PER AKE; MILICEVIC, MISLAV
To: SPEEDMENT AB
Reel/Frame 063699/0060 →
Continuity (2)
Provisional Application 63067924 · Aug 20, 2020
Related Publication 20240020302A1 · Jan 18, 2024
References Cited (21)
US 7962902B2 · Chow · 2011 [cited by examiner]
US 9378034B2 · Matov · 2016 [cited by examiner]
US 11907312B1 · Li · 2024 [cited by examiner]
US 20040015834A1 · Mestre · 2004 [cited by examiner]
US 20060048097A1 · Doshi · 2006 [cited by examiner]
US 20100122239A1 · Neufeld · 2010 [cited by examiner]
US 20100211939A1 · Ali · 2010 [cited by examiner]
US 20100241637A1 · Kissner · 2010 [cited by examiner]
US 20100293209A1 · Bireley · 2010 [cited by examiner]
US 20100332473A1 · Brodsky · 2010 [cited by examiner]
US 20120124080A1 · Willard · 2012 [cited by examiner]
US 20130054630A1 · Briggs · 2013 [cited by examiner]
US 20150278314A1 · Fuglsang · 2015 [cited by examiner]
US 20170161307A1 · Minborg · 2017 [cited by examiner]
US 20180052708A1 · Ganesan · 2018 [cited by examiner]
US 20210034615A1 · Chen · 2021 [cited by examiner]
US 20210248143A1 · Khillar · 2021 [cited by examiner]
US 20240020302A1 · Minborg · 2024 [cited by examiner]
Khaled Alshurafa; Type-safe Functional Queries over Object-oriented Data Models; Hamburg University of Science and Technology Software Systems Institute (STS) Jul. 30, 2009 (Year: 2009). [cited by examiner]
International Search Report mailed Nov. 29, 2021, for priority International Patent Application No. PCT/EP2021/073191. [cited by applicant]
International Preliminary Report on Patentability mailed Dec. 6, 2022, for priority International Patent Application No. PCT/EP2021/073191. [cited by applicant]