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();

Last updated