Top Inners Fields Constructors Methods
com.fasterxml.jackson.datatype.hibernate5

public Class Hibernate5Module

extends Module
Class Inheritance
Imports
com.fasterxml.jackson.core.Version, com.fasterxml.jackson.databind.AnnotationIntrospector, .Module, org.hibernate.SessionFactory, org.hibernate.engine.spi.Mapping

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum
Hibernate5Module.Feature

Enumeration that defines all toggleable features this module

Field Summary

Modifier and TypeField and Description
protected final Mapping
_mapping

Hibernate mapping.

protected int
_moduleFeatures

Bit flag composed of bits that indicate which Features are enabled.

protected final SessionFactory
_sessionFactory

References Deprecated SessionFactory is deprecated or references (maybe indirectly) at least one deprecated element.
protected static final int

Constructor Summary

AccessConstructor and Description
public
public
public
Hibernate5Module(SessionFactory sessionFactory)
References Deprecated SessionFactory is deprecated or references (maybe indirectly) at least one deprecated element.

public
Hibernate5Module(Mapping mapping, SessionFactory sessionFactory)
References Deprecated SessionFactory is deprecated or references (maybe indirectly) at least one deprecated element.

Method Summary

Modifier and TypeMethod and Description
protected AnnotationIntrospector
annotationIntrospector()

Method called during setupModule, to create com.fasterxml.jackson.databind.AnnotationIntrospector to register along with module.

public Hibernate5Module
public Hibernate5Module
public Hibernate5Module
public String
getModuleName()

Implements abstract com.fasterxml.jackson.databind.Module.getModuleName.

Method that returns a display that can be used by Jackson for informational purposes, as well as in associating extensions with module that provides them.

public final boolean
public void
setupModule(Module.SetupContext context)

Implements abstract com.fasterxml.jackson.databind.Module.setupModule.

Method called by ObjectMapper when module is registered.

public Version
version()

Implements abstract com.fasterxml.jackson.databind.Module.version.

Implements com.fasterxml.jackson.core.Versioned.version.

Method that returns version of this module.

Inherited from com.fasterxml.jackson.databind.Module:
getDependenciesgetTypeId

Field Detail

_mappingback to summary
protected final Mapping _mapping

Hibernate mapping.

_moduleFeaturesback to summary
protected int _moduleFeatures

Bit flag composed of bits that indicate which Features are enabled.

_sessionFactoryback to summary
protected final SessionFactory _sessionFactory

References Deprecated

SessionFactory is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

DEFAULT_FEATURESback to summary
protected static final int DEFAULT_FEATURES

Constructor Detail

Hibernate5Moduleback to summary
public Hibernate5Module()
Hibernate5Moduleback to summary
public Hibernate5Module(Mapping mapping)
Hibernate5Moduleback to summary
public Hibernate5Module(SessionFactory sessionFactory)

References Deprecated

SessionFactory is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Hibernate5Moduleback to summary
public Hibernate5Module(Mapping mapping, SessionFactory sessionFactory)

References Deprecated

SessionFactory is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Method Detail

annotationIntrospectorback to summary
protected AnnotationIntrospector annotationIntrospector()

Method called during setupModule, to create com.fasterxml.jackson.databind.AnnotationIntrospector to register along with module. If null is returned, no introspector is added.

configureback to summary
public Hibernate5Module configure(Hibernate5Module.Feature f, boolean state)
disableback to summary
public Hibernate5Module disable(Hibernate5Module.Feature f)
enableback to summary
public Hibernate5Module enable(Hibernate5Module.Feature f)
getModuleNameback to summary
public String getModuleName()

Implements abstract com.fasterxml.jackson.databind.Module.getModuleName.

Doc from com.fasterxml.jackson.databind.Module.getModuleName.

Method that returns a display that can be used by Jackson for informational purposes, as well as in associating extensions with module that provides them.

Annotations
@Override
isEnabledback to summary
public final boolean isEnabled(Hibernate5Module.Feature f)
setupModuleback to summary
public void setupModule(Module.SetupContext context)

Implements abstract com.fasterxml.jackson.databind.Module.setupModule.

Doc from com.fasterxml.jackson.databind.Module.setupModule.

Method called by ObjectMapper when module is registered. It is called to let module register functionality it provides, using callback methods passed-in context object exposes.

Annotations
@Override
versionback to summary
public Version version()

Implements abstract com.fasterxml.jackson.databind.Module.version.

Implements com.fasterxml.jackson.core.Versioned.version.

Doc from com.fasterxml.jackson.databind.Module.version.

Method that returns version of this module. Can be used by Jackson for informational purposes.

Returns:Version

Doc from com.fasterxml.jackson.core.Versioned.version.

Version of the component

Annotations
@Override
com.fasterxml.jackson.datatype.hibernate5 back to summary

public final Enum Hibernate5Module.Feature

extends Enum<Hibernate5Module.Feature>
Class Inheritance

Enumeration that defines all toggleable features this module

Field Summary

Modifier and TypeField and Description
pack-priv final boolean
pack-priv final int
public static final Hibernate5Module.Feature
FORCE_LAZY_LOADING

Whether lazy-loaded object should be forced to be loaded and then serialized (true); or serialized as nulls (false).

public static final Hibernate5Module.Feature
REPLACE_PERSISTENT_COLLECTIONS

Feature that may be enabled to force replacement org.hibernate.collection.spi.PersistentCollection, List, Set, Map subclasses during serialization as standard JDK java.util.List, java.util.Set and java.util.Map.

public static final Hibernate5Module.Feature
REQUIRE_EXPLICIT_LAZY_LOADING_MARKER

This feature determines how org.hibernate.collection.spi.PersistentCollections properties for which no annotation is found are handled with respect to lazy-loading: if true, lazy-loading is only assumed if annotation is used to indicate that; if false, lazy-loading is assumed to be the default.

public static final Hibernate5Module.Feature
SERIALIZE_IDENTIFIER_FOR_LAZY_NOT_LOADED_OBJECTS

If FORCE_LAZY_LOADING is false, this feature serializes uninitialized lazy loading proxies as {"identifierName":"identifierValue"} rather than null.

public static final Hibernate5Module.Feature
USE_TRANSIENT_ANNOTATION

Whether javax.persistence.Transient annotation should be checked or not; if true, will consider @Transient to mean that property is to be ignored; if false annotation will have no effect.

public static final Hibernate5Module.Feature
WRAP_IDENTIFIER_IN_OBJECT

Feature that may be disables to unwrap the identifier of the serialized entity, returning a value instead of an object.

public static final Hibernate5Module.Feature
WRITE_MISSING_ENTITIES_AS_NULL

Using FORCE_LAZY_LOADING may result in `javax.persistence.EntityNotFoundException`.

Constructor Summary

AccessConstructor and Description
private
Feature(boolean defaultState)

Method Summary

Modifier and TypeMethod and Description
public static int
collectDefaults()

Method that calculates bit set (flags) of all features that are enabled by default.

public boolean
public boolean
enabledIn(int flags)

public int
public static Hibernate5Module.Feature
public static Hibernate5Module.Feature[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

_defaultStateback to summary
pack-priv final boolean _defaultState
_maskback to summary
pack-priv final int _mask
FORCE_LAZY_LOADINGback to summary
public static final Hibernate5Module.Feature FORCE_LAZY_LOADING

Whether lazy-loaded object should be forced to be loaded and then serialized (true); or serialized as nulls (false).

Default value is false.

REPLACE_PERSISTENT_COLLECTIONSback to summary
public static final Hibernate5Module.Feature REPLACE_PERSISTENT_COLLECTIONS

Feature that may be enabled to force replacement org.hibernate.collection.spi.PersistentCollection, List, Set, Map subclasses during serialization as standard JDK java.util.List, java.util.Set and java.util.Map. This is usually done to prevent issues with polymorphic handling, so that type id is generated for standard containers and NOT for Hibernate variants.

Default setting is false, so that no replacement occurs.

Since
2.8.2
REQUIRE_EXPLICIT_LAZY_LOADING_MARKERback to summary
public static final Hibernate5Module.Feature REQUIRE_EXPLICIT_LAZY_LOADING_MARKER

This feature determines how org.hibernate.collection.spi.PersistentCollections properties for which no annotation is found are handled with respect to lazy-loading: if true, lazy-loading is only assumed if annotation is used to indicate that; if false, lazy-loading is assumed to be the default. Note that FORCE_LAZY_LOADING has priority over this Feature; meaning that if it is defined as true, setting of this Feature has no effect.

Default value is false, meaning that laziness is considered to be the default value.

Since
2.4
SERIALIZE_IDENTIFIER_FOR_LAZY_NOT_LOADED_OBJECTSback to summary
public static final Hibernate5Module.Feature SERIALIZE_IDENTIFIER_FOR_LAZY_NOT_LOADED_OBJECTS

If FORCE_LAZY_LOADING is false, this feature serializes uninitialized lazy loading proxies as {"identifierName":"identifierValue"} rather than null.

Default value is false.

Note that the name of the identifier property can only be determined if

  • the Mapping is provided to the Hibernate5Module, or
  • the persistence context that loaded the proxy has not yet been closed, or
  • the id property is mapped with property access (for instance because the @Id annotation is applied to a method rather than a field)
Otherwise, the entity name will be used instead.
USE_TRANSIENT_ANNOTATIONback to summary
public static final Hibernate5Module.Feature USE_TRANSIENT_ANNOTATION

Whether javax.persistence.Transient annotation should be checked or not; if true, will consider @Transient to mean that property is to be ignored; if false annotation will have no effect.

Default value is true.

WRAP_IDENTIFIER_IN_OBJECTback to summary
public static final Hibernate5Module.Feature WRAP_IDENTIFIER_IN_OBJECT

Feature that may be disables to unwrap the identifier of the serialized entity, returning a value instead of an object.

Since
2.12
WRITE_MISSING_ENTITIES_AS_NULLback to summary
public static final Hibernate5Module.Feature WRITE_MISSING_ENTITIES_AS_NULL

Using FORCE_LAZY_LOADING may result in `javax.persistence.EntityNotFoundException`. This flag configures Jackson to ignore the error and serialize a `null`.

Since
2.10

Constructor Detail

Featureback to summary
private Feature(boolean defaultState)

Method Detail

collectDefaultsback to summary
public static int collectDefaults()

Method that calculates bit set (flags) of all features that are enabled by default.

enabledByDefaultback to summary
public boolean enabledByDefault()
enabledInback to summary
public boolean enabledIn(int flags)
getMaskback to summary
public int getMask()
valueOfback to summary
public static Hibernate5Module.Feature valueOf(String name)
valuesback to summary
public static Hibernate5Module.Feature[] values()