Top Description Constructors Methods
org.hibernate.pretty

public final Class MessageHelper

extends Object
Class Inheritance
Annotations
@Internal
Imports
org.hibernate.Internal, org.hibernate.collection.spi.PersistentCollection, org.hibernate.engine.spi.EntityEntry, .SessionFactoryImplementor, .SharedSessionContractImplementor, org.hibernate.persister.collection.CollectionPersister, org.hibernate.persister.entity.EntityPersister, org.hibernate.type.Type, org.checkerframework.checker.nullness.qual.Nullable

MessageHelper methods for rendering log messages relating to managed entities and collections typically used in log statements and exception messages.
Author
Max Andersen, Gavin King

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private static void
addIdToCollectionInfoString(CollectionPersister persister, Object id, SessionFactoryImplementor factory, StringBuilder s)

Deprecated as a consequence of SessionFactoryImplementor being deprecated.
public static String

Returns:

An info string, in the form [Foo.bars#1]
collectionInfoString
(@Nullable CollectionPersister
The persister for the collection
persister
,
@Nullable PersistentCollection<?>
The collection itself
collection
,
Object
The collection key
collectionKey
,
SharedSessionContractImplementor
The session
session
)

Generate an info message string relating to a particular managed collection.

public static String

Returns:

An info string, in the form [Foo.bars#<1,2,3>]
collectionInfoString
(@Nullable CollectionPersister
The persister for the collections
persister
,
Object[]
The id values of the owners
ids
,
SessionFactoryImplementor
The session factory
factory
)

Deprecated as a consequence of SessionFactoryImplementor being deprecated.
Generate an info message string relating to a series of managed collections.
public static String

Returns:

An info string, in the form [Foo.bars#1]
collectionInfoString
(@Nullable CollectionPersister
The persister for the collection
persister
,
@Nullable Object
The id value of the owner
id
,
SessionFactoryImplementor
The session factory
factory
)

Deprecated as a consequence of SessionFactoryImplementor being deprecated.
Generate an info message string relating to a particular managed collection.
public static String

Returns:

An info string, in the form [Foo.bars#1]
collectionInfoString
(@Nullable String
The role-name of the collection
role
,
@Nullable Object
The id value of the owner
id
)

Generate an info message string relating to a particular managed collection.

public static String

Returns:

An info string, in the form [FooBar#1].
infoString
(@Nullable String
The defined entity name.
entityName
,
@Nullable Object
The entity id value.
id
)

Generate an info message string relating to a particular entity, based on the given entityName and id.

public static String

Returns:

An info string, in the form [FooBar#1]
infoString
(@Nullable EntityPersister
The persister for the entity
persister
,
@Nullable Object
The entity id value
id
,
@Nullable SessionFactoryImplementor
The session factory - Could be null!
factory
)

Deprecated as a consequence of SessionFactoryImplementor being deprecated.
Generate an info message string relating to a particular entity.
public static String

Returns:

An info string, in the form [FooBar#1]
infoString
(@Nullable EntityPersister
The persister for the entity
persister
,
@Nullable Object
The entity id value
id
,
Type
The entity identifier type mapping
identifierType
,
SessionFactoryImplementor
The session factory
factory
)

Deprecated as a consequence of SessionFactoryImplementor being deprecated.
Generate an info message string relating to a particular entity,.
public static String

Returns:

An info string, in the form [FooBar#<1,2,3>]
infoString
(@Nullable EntityPersister
The persister for the entities
persister
,
Object[]
The entity id values
ids
,
SessionFactoryImplementor
The session factory
factory
)

Deprecated as a consequence of SessionFactoryImplementor being deprecated.
Generate an info message string relating to a series of entities.
public static String

Returns:

An info string, in the form [FooBar]
infoString
(@Nullable EntityPersister
The persister.
persister
)

Generate an info message string relating to given entity persister.

public static String

Returns:

An info string, in the form [Foo.bars#1]
infoString
(String
The entity name
entityName
,
String
The name of the property
propertyName
,
@Nullable Object
The property value.
key
)

Generate an info message string relating to a given property value for an entity.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

MessageHelperback to summary
private MessageHelper()

Method Detail

addIdToCollectionInfoStringback to summary
private static void addIdToCollectionInfoString(CollectionPersister persister, Object id, SessionFactoryImplementor factory, StringBuilder s)

Deprecated

as a consequence of SessionFactoryImplementor being deprecated. See corresponding docs for further information.

collectionInfoStringback to summary
public static String collectionInfoString(@Nullable CollectionPersister persister, @Nullable PersistentCollection<?> collection, Object collectionKey, SharedSessionContractImplementor session)

Generate an info message string relating to a particular managed collection. Attempts to intelligently handle property-refs issues where the collection key is not the same as the owner key.

Parameters
persister:@Nullable CollectionPersister

The persister for the collection

collection:@Nullable PersistentCollection<?>

The collection itself

collectionKey:Object

The collection key

session:SharedSessionContractImplementor

The session

Returns:String

An info string, in the form [Foo.bars#1]

collectionInfoStringback to summary
public static String collectionInfoString(@Nullable CollectionPersister persister, Object[] ids, SessionFactoryImplementor factory)

Deprecated

as a consequence of SessionFactoryImplementor being deprecated. See corresponding docs for further information.

Generate an info message string relating to a series of managed collections.

Parameters
persister:@Nullable CollectionPersister

The persister for the collections

ids:Object[]

The id values of the owners

factory:SessionFactoryImplementor

The session factory

Returns:String

An info string, in the form [Foo.bars#<1,2,3>]

collectionInfoStringback to summary
public static String collectionInfoString(@Nullable CollectionPersister persister, @Nullable Object id, SessionFactoryImplementor factory)

Deprecated

as a consequence of SessionFactoryImplementor being deprecated. See corresponding docs for further information.

Generate an info message string relating to a particular managed collection.

Parameters
persister:@Nullable CollectionPersister

The persister for the collection

id:@Nullable Object

The id value of the owner

factory:SessionFactoryImplementor

The session factory

Returns:String

An info string, in the form [Foo.bars#1]

collectionInfoStringback to summary
public static String collectionInfoString(@Nullable String role, @Nullable Object id)

Generate an info message string relating to a particular managed collection.

Parameters
role:@Nullable String

The role-name of the collection

id:@Nullable Object

The id value of the owner

Returns:String

An info string, in the form [Foo.bars#1]

infoStringback to summary
public static String infoString(@Nullable String entityName, @Nullable Object id)

Generate an info message string relating to a particular entity, based on the given entityName and id.

Parameters
entityName:@Nullable String

The defined entity name.

id:@Nullable Object

The entity id value.

Returns:String

An info string, in the form [FooBar#1].

infoStringback to summary
public static String infoString(@Nullable EntityPersister persister, @Nullable Object id, @Nullable SessionFactoryImplementor factory)

Deprecated

as a consequence of SessionFactoryImplementor being deprecated. See corresponding docs for further information.

Generate an info message string relating to a particular entity.

Parameters
persister:@Nullable EntityPersister

The persister for the entity

id:@Nullable Object

The entity id value

factory:@Nullable SessionFactoryImplementor

The session factory - Could be null!

Returns:String

An info string, in the form [FooBar#1]

infoStringback to summary
public static String infoString(@Nullable EntityPersister persister, @Nullable Object id, Type identifierType, SessionFactoryImplementor factory)

Deprecated

as a consequence of SessionFactoryImplementor being deprecated. See corresponding docs for further information.

Generate an info message string relating to a particular entity,.

Parameters
persister:@Nullable EntityPersister

The persister for the entity

id:@Nullable Object

The entity id value

identifierType:Type

The entity identifier type mapping

factory:SessionFactoryImplementor

The session factory

Returns:String

An info string, in the form [FooBar#1]

infoStringback to summary
public static String infoString(@Nullable EntityPersister persister, Object[] ids, SessionFactoryImplementor factory)

Deprecated

as a consequence of SessionFactoryImplementor being deprecated. See corresponding docs for further information.

Generate an info message string relating to a series of entities.

Parameters
persister:@Nullable EntityPersister

The persister for the entities

ids:Object[]

The entity id values

factory:SessionFactoryImplementor

The session factory

Returns:String

An info string, in the form [FooBar#<1,2,3>]

infoStringback to summary
public static String infoString(@Nullable EntityPersister persister)

Generate an info message string relating to given entity persister.

Parameters
persister:@Nullable EntityPersister

The persister.

Returns:String

An info string, in the form [FooBar]

infoStringback to summary
public static String infoString(String entityName, String propertyName, @Nullable Object key)

Generate an info message string relating to a given property value for an entity.

Parameters
entityName:String

The entity name

propertyName:String

The name of the property

key:@Nullable Object

The property value.

Returns:String

An info string, in the form [Foo.bars#1]