Microstream Integration aims to explore the capability of Jakarta persistence specifications to make your life as a Java developer easier.
-
Jakarta Data’s goal is to provide a familiar and consistent, Jakarta-based programming model for data access while still retaining the particular traits of the underlying data store.
-
Jakarta NoSQL is a Java framework that streamlines the integration of Java applications with NoSQL databases.
-
Increase productivity performing common Microstream operations
-
Rich Object Mapping integrated
-
Java-based Query and Fluent-API
-
Explore repository capability
For mapping both Data and NoSQL specifications, you should use Jakarta NoSQL. Check the NoSQL for more information.
@Entity
public class Book {
@Id
private String isbn;
@Column
private String title;
@Column
private Integer edition;
@Column
private Year release;
@Column
private String author;
@Column
private boolean active;
...
}
Warning
|
This Template implementation uses a java.util.Map as the data structure root on Microstream, the one.microstream.collections.lazy.LazyHashMap provided by Microstream.
|
@Inject
Template template;
...
Book effectiveJava = new Book();
template.insert(effectiveJava);
List<Book> result = template.select(Book.class).where("title").eq("Effective Java").result();
template.delete(Book.class).where("edition").lte(2).execute();
A repository abstraction aims to significantly reduce the boilerplate code required to implement data access layers for various persistence stores.
@Repository
public interface Library extends PageableRepository<Book, String> {
List<Book> findByTitle(String title);
}
@Inject
private Library library;
...
List<Book> cleanCode = this.library.findByTitle("Clean Code");
Microstream provides a qualifier when there are other vendors for both: Jakarta NoSQL and Jakarta Data.
You can add @Microstream
qualifier.
@Inject
@Microstream
private Template template;
@Inject
@Microstream
private Library library;
Add the Maven dependency:
<dependency>
<groupId>expert.os.integration</groupId>
<artifactId>microstream-jakarta-data</artifactId>
<version>0.0.4</version>
</dependency>
By default, it will run the application and create an embedded solution.
Be aware it is only for test
proposals.
Microstream integrates with several persistence engines where you can setup it up quickly. You can use Redis, MySQL, and Amazon S3; check more info here.
You can overwrite this behavior programmatically.
@Alternative
@Priority(Interceptor.Priority.APPLICATION)
@ApplicationScoped
class CustomSupplier implements Supplier<StorageManager>{
@Override
@Produces
@ApplicationScoped
public StorageManager get() {
StorageManager manager = //some configuration
return manager.start();
}
}
Warning
|
The integration works with the `StorageManager started. |