MicroStream Reference Manual
MicroStream Home
API Docs
Search…
4.1
Preface
System Requirements
License
Changelog
Installation
Data-Store
Overview
Getting Started
Root Instances
Configuration
Storage Targets
Storing Data
Convenience Methods and Explicit Storing (Transactions)
Lazy and Eager Storing
Transient Fields
Best Practice
Loading Data
Deleting Data
Queries
Application Life-Cycle
Legacy Type Mapping
Import / Export
Housekeeping
Customizing
REST Interface
FAQ
Addendum
Cache
Overview
Getting Started
Configuration
Use Cases
Basic Concepts
Layered Entities
Wrapping
Powered By
GitBook
Transient Fields
This is the manual for older MicroStream versions (Version < 5.0).
The new documentation (Version >= 5.0) is located at:
​
https://docs.microstream.one/
​
The default MicroStream implementation fully supports the Java transient field modifier. Class members marked transient will not be persisted.
public
class
User
{
private
String
username
;
//do not persist the users password
private
transient
String
password
;
}
It is possible to override the default behavior by implementing a custom
PersistenceFieldEvaluator
.
PersistenceFieldEvaluator
fieldEvaluator
=
(
clazz
,
field
)
->
!
field
.
getName
().
startsWith
(
"_"
);
EmbeddedStorageManager
storage
=
EmbeddedStorage
.
Foundation
()
.
onConnectionFoundation
(
c
->
c
.
setFieldEvaluatorPersistable
(
fieldEvaluator
)
)
.
createEmbeddedStorageManager
()
.
start
();
​
Previous
Lazy and Eager Storing
Next
Best Practice
Last modified
1yr ago
Export as PDF
Copy link