# US 2020/0394202 A1 · System and a method of fast java object materialization from database data

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2020/0394202 A1
- Document ID: US20200394202A1
- Status: Published application
- Kind: A1
- Application number: 17/008,166
- Filed: 2020-08-31
- Published: 2020-12-17
- Earliest claimed: 2018-04-12
- Assignees: Huawei Technologies Co., Ltd.
- Applicants: Huawei Technologies Co., Ltd.
- Inventors: Alexander Vladimirovich SLESARENKO; Junchao MA
- Web page: https://patentgrep.com/patent/US20200394202A1

## CPC

- G06F 9/465: {Distributed object oriented systems (remote method invocation [RMI] G06F9/548)}
- G06F 16/256: {in federated or virtual databases}
- G06F 9/4552: {Involving translation to a different instruction set architecture, e.g. just-in-time translation in a JVM}
- G06F 9/545: {where tasks reside in different layers, e.g. user- and kernel-space}
- G06F 9/547: {Remote procedure calls [RPC]; Web services}
- G06F 16/24552: {Database cache management}
- G06F 16/289: {Object oriented databases}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

An apparatus for extracting data from a database for object initialization, and apparatus for writing object data to a database, and corresponding methods are provided. A data extraction kernel on the native-side reads database data from a plurality of locations in the database using a database interface and writes the database data to a buffer using a native-side buffer API (application programming interface). An object initialization kernel on the virtual machine (VM-)side reads the database data from the buffer using a native-side buffer API and initializes a plurality of objects. Information indicating one of the plural memory regions in the buffer where the data extraction kernel writes the database data is known to the native-side buffer API and to the VM-side buffer API. According to the application, fast and memory efficient data exchange between a native side and VM side is achieved.

## Claims

### Claim 1

An apparatus for extracting data from a database, the apparatus comprising:
a database interface configured to enable communication between the apparatus and the database;
a virtual machine (VM);
a buffer comprising a plurality of memory regions;
a data extraction kernel on a native side, the data extraction kernel comprising a native-side buffer application programming interface (API), and being configured to read database data from a plurality of locations in the database using the database interface and write the database data to the buffer using the native-side buffer API, the database data corresponding to a query result;
an object initialization kernel on a VM-side, the object initialization kernel comprising a VM-side buffer API and being configured to read the database data from the buffer using the VM-side buffer API and to initialize a plurality of objects with the database data read from the buffer;
wherein information indicating one of the plural memory regions in the buffer where the data extraction kernel writes the database data is known to the native-side buffer API and to the VM-side buffer API.

### Claim 2 (depends on 1)

The apparatus according to claim 1, wherein the data extraction kernel comprises a native-side multi-cursor to extract the database data from the database, the native-side multi-cursor comprises a plurality of cursors,
the object initialization kernel comprises a VM-side multi-cursor to extract the database data from the buffer, the VM-side multi-cursor comprises a plurality of cursors,
a cursor of the native-side multi-cursor is configured to iterate over items of the database data in one of the plural locations in the database independent of the locations of the other cursors of the native-side multi-cursor, and
a cursor of the VM-side multi-cursor is configured to iterate over items of the database data synchronously with the iteration of the cursor of the native-side multi-cursor.

### Claim 3 (depends on 2)

The apparatus according to claim 2, wherein the cursor of the VM-side multi-cursor is configured to pass an iteration call to the cursor of the native-side multi-cursor, and
the cursor of the native-side multi-cursor is configured to perform, upon reception of the iteration call, a cursor process synchronously with the VM-side database cursor by reading an item of the database data from the database and writing the item of the database data to the buffer.

### Claim 4 (depends on 3)

The apparatus according to claim 3, wherein the plurality of memory regions is located on the native side; the VM-side buffer API comprises a direct buffer on the VM-side,
the cursor of the native-side multi-cursor is further configured to pass, upon reception of the iteration call, the location of the one of the plural memory regions to the direct buffer, and
the object initialization kernel is configured to obtain the database data for initializing the objects by accessing the direct buffer.

### Claim 5 (depends on 3)

The apparatus according to claim 3, wherein the plurality of memory regions are located on the native side,
the cursor of the native-side multi-cursor is further configured to create, upon reception of the iteration call, a new direct buffer in the VM-side buffer API and to pass a direct address of the one of the plural memory regions via the buffer API to the direct buffer, and
the object initialization kernel is configured to obtain the database data for initializing the object by accessing the direct buffer.

### Claim 6 (depends on 1)

The apparatus according to claim 1, wherein the plurality of memory regions is located on the VM-side, and the data extraction kernel is configured to write the database data to the buffer via the native-side buffer API.

### Claim 7 (depends on 2)

The apparatus according to claim 2, wherein the object initialization kernel is configured to initialize an object of the plurality of objects with the database data within a cursor process for each cursor in the native-side multi-cursor.

### Claim 8 (depends on 1)

The apparatus according to claim 1, further comprising a kernel generator for generating the object initialization kernel and wherein the data extraction kernel and the kernel generator are configured to generate:
the object initialization kernel based on a first isomorphism between respective object types of the plurality of objects and a data format of the region layout in the buffer and
the data extraction kernel based on a second isomorphism between a data format of the database data in the database interface and the data format of the region layout in the buffer,
wherein the first isomorphism and the second isomorphism are input to the kernel generator, the isomorphisms being data structures representing program code.

### Claim 9 (depends on 8)

The apparatus according to claim 8, wherein a data model, an object-relational mapping (ORM), a data access application programming interface (API), a definition of the native-side buffer API and/or a definition of the VM-side buffer API are further input to the kernel generator.

### Claim 10 (depends on 8)

The apparatus according to claim 8, wherein the kernel generator generates the object initialization kernel and the data extraction kernel dynamically at runtime.

### Claim 11 (depends on 1)

The apparatus according to claim 1, wherein the plurality of objects are a Java objects and the VM is a Java VM.

### Claim 12

An apparatus for writing data to a database, the apparatus comprising:
a database interface configured to enable communication between the apparatus and the database;
a virtual machine (VM);
a buffer comprising a plurality of memory regions;
an object processing kernel on a VM-side, the object processing kernel comprising a VM-side buffer application programming interface (API), and being configured to write object data from a plurality of objects to the buffer using the VM-side buffer API,
a data writing kernel on a native side, the data writing kernel comprising a native-side buffer API, and being configured to read the object data from the buffer using the native-side buffer API and write the object data to a plurality of locations in the database using the database interface,
wherein information indicating one of the plural memory regions in the buffer where the object processing kernel writes the object data is known to the native-side buffer API and to the VM-side buffer API.

### Claim 13

A method for extracting data from a database, wherein the method is applied to an apparatus for extracting the data from the database, and the method comprises:
reading database data from a plurality of locations in the database using a database interface, the database data corresponding to a query result,
writing the database data to a buffer comprising a plurality of memory regions using a native-side buffer application programming interface (API),
reading database data from the buffer using a virtual machine (VM)-side buffer API, and
initializing a plurality of objects with the database data read from the buffer,
wherein information indicating one of the plural memory regions in the buffer where database data is written known to the native-side buffer API and to the VM-side buffer API.

### Claim 14

A method for writing data to a database, wherein the method is applied to an apparatus for writing the data to the database, and the method comprises:
writing object data from a plurality of objects to a buffer comprising a plurality of memory regions using a virtual machine (VM)-side buffer application programming interface (API),
reading the object data from the buffer using a native-side buffer API, and
writing the object data to a plurality of locations in the database using the database interface,
wherein information indicating one of the plural memory regions in the buffer where the object data is written is known to the native-side buffer API and to the VM-side buffer API.

### Claim 15 (depends on 13)

A non-transitory computer readable medium storing instructions causing a computer to perform a method according to claim 13.

### Claim 16 (depends on 14)

A non-transitory computer readable medium storing instructions causing a computer to perform a method according to claim 14.

### Claim 17 (depends on 13)

The method according to claim 13, further comprising:
iterating over items of the database data in one of the plural locations in the database independent of the locations of the other cursors of the native-side multi-cursor, and
iterating over items of the database data synchronously with the iteration of the cursor of the native-side multi-cursor.
