Top Description Inners Fields Constructors Methods
org.hibernate.loader

public Class JoinWalker

extends Object
Class Inheritance
Known Direct Subclasses
org.hibernate.loader.collection.CollectionJoinWalker, org.hibernate.loader.AbstractEntityJoinWalker
Imports
java.util.ArrayList, .Arrays, .Collections, .HashSet, .Iterator, .List, .Set, org.hibernate.FetchMode, .LockMode, .LockOptions, .MappingException, org.hibernate.dialect.Dialect, org.hibernate.engine.internal.JoinHelper, org.hibernate.engine.spi.CascadeStyle, .LoadQueryInfluencers, .SessionFactoryImplementor, org.hibernate.internal.util.StringHelper, org.hibernate.internal.util.collections.ArrayHelper, org.hibernate.persister.collection.CollectionPersister, .QueryableCollection, org.hibernate.persister.entity.EntityPersister, .Joinable, .Loadable, .OuterJoinLoadable, org.hibernate.sql.ConditionFragment, .DisjunctionFragment, .InFragment, .JoinFragment, .JoinType, org.hibernate.type.AssociationType, .CompositeType, .EntityType, .ForeignKeyDirection, .Type

Walks the metamodel, searching for joins, and collecting together information needed by OuterJoinLoader.
Author
Gavin King, Jon Lipsky
See Also
OuterJoinLoader

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected static interface
private static class
JoinWalker.AssociationKey

Uniquely identifier a foreign key, so that we don't join it more than once, and create circularities

Field Summary

Modifier and TypeField and Description
protected String[]
protected final List<E>
protected int[]
protected CollectionPersister[]
protected String[]
private final SessionFactoryImplementor
factory

Deprecated as a consequence of SessionFactoryImplementor being deprecated.
private final LoadQueryInfluencers
protected LockMode[]
protected LockOptions
protected EntityType[]
protected int[]
protected Loadable[]
protected String
protected String[]
private final Set<E>

Constructor Summary

AccessConstructor and Description
protected
JoinWalker(SessionFactoryImplementor factory, LoadQueryInfluencers loadQueryInfluencers)

Deprecated as a consequence of SessionFactoryImplementor being deprecated.

Method Summary

Modifier and TypeMethod and Description
private void
addAssociationToJoinTree(final AssociationType type, final String[] aliasedLhsColumns, final String alias, final PropertyPath path, final int currentDepth, final JoinType joinType)

Add on association (one-to-one, many-to-one, or a collection) to a list of associations to be fetched by outerjoin

private void
addAssociationToJoinTreeIfNecessary(final AssociationType type, final String[] aliasedLhsColumns, final String alias, final PropertyPath path, int currentDepth, final JoinType joinType)

Add on association (one-to-one, many-to-one, or a collection) to a list of associations to be fetched by outerjoin (if necessary)

protected static int
countCollectionPersisters(List<E> associations)

Count the number of instances of Joinable which are actually also instances of PersistentCollection which are being fetched by outer join

protected static int
countEntityPersisters(List<E> associations)

Count the number of instances of Joinable which are actually also instances of Loadable, or are one-to-many associations

protected String
generateRootAlias(final String description)

protected String
generateTableAlias(final int n, final PropertyPath path, final Joinable joinable)

public String[]
public List<E>
public int[]
public CollectionPersister[]
public String[]
protected Dialect
protected SessionFactoryImplementor
getFactory()

Deprecated as a consequence of SessionFactoryImplementor being deprecated.
protected JoinType

Returns:

type of join to use (org.hibernate.sql.JoinType#INNER_JOIN, org.hibernate.sql.JoinType#LEFT_OUTER_JOIN, or -1 to indicate no joining.
getJoinType
(OuterJoinLoadable
The owner of the association.
persister
,
final PropertyPath
The path to the association
path
,
int
The property number representing the association.
propertyNumber
,
AssociationType
The association type.
associationType
,
FetchMode
The metadata-defined fetch mode.
metadataFetchMode
,
CascadeStyle
The metadata-defined cascade style.
metadataCascadeStyle
,
String
The owner table
lhsTable
,
String[]
The owner join columns
lhsColumns
,
final boolean
Is the association nullable.
nullable
,
final int
Current join depth
currentDepth
)

Determine the appropriate type of join (if any) to use to fetch the given association.

protected JoinType

Returns:

type of join to use (org.hibernate.sql.JoinType#INNER_JOIN, org.hibernate.sql.JoinType#LEFT_OUTER_JOIN, or -1 to indicate no joining.
getJoinType
(AssociationType
The association associationType.
associationType
,
FetchMode
The metadata-defined fetch mode.
config
,
PropertyPath
The path to the association
path
,
String
The owner table
lhsTable
,
String[]
The owner join columns
lhsColumns
,
boolean
Is the association nullable.
nullable
,
int
Current join depth
currentDepth
,
CascadeStyle
The metadata-defined cascade style.
cascadeStyle
)

Determine the appropriate associationType of join (if any) to use to fetch the given association.

protected JoinType
getJoinType(boolean nullable, int currentDepth)

Use an inner join if it is a non-null association and this is the "first" join in a series

public LoadQueryInfluencers
public LockMode[]
public LockOptions
public EntityType[]
public int[]
public Loadable[]
public String
public String[]
protected String
protected boolean
protected void
initPersisters(final List<E> associations, final LockMode lockMode)

protected void
initPersisters(final List<E> associations, final LockOptions lockOptions)

protected void
initPersisters(final List<E> associations, final LockOptions lockOptions, final JoinWalker.AssociationInitCallback callback)

protected boolean
isDuplicateAssociation(final String foreignKeyTable, final String[] foreignKeyColumns)

Used to detect circularities in the joined graph, note that this method is side-effecty

protected boolean
isDuplicateAssociation(final String lhsTable, final String[] lhsColumnNames, final AssociationType type)

Used to detect circularities in the joined graph, note that this method is side-effecty

protected boolean
isJoinable(final JoinType joinType, final Set<E> visitedAssociationKeys, final String lhsTable, final String[] lhsColumnNames, final AssociationType type, final int depth)

Should we join this association?

protected boolean
isJoinedFetchEnabled(AssociationType type, FetchMode config, CascadeStyle cascadeStyle)

Override on subclasses to enable or suppress joining of certain association types

protected boolean
isJoinedFetchEnabledInMapping(FetchMode config, AssociationType type)

Does the mapping, and Hibernate default semantics, specify that this association should be fetched by outer joining

protected boolean
isTooDeep(int currentDepth)

protected boolean
protected static String
mergeOrderings(String ordering1, String ordering2)

protected final JoinFragment
mergeOuterJoins(List<E> associations)

Generate a sequence of LEFT OUTER JOIN clauses for the given associations.

protected String
orderBy(final List<E> associations, final String orderBy)

protected static String
orderBy(List<E> associations)

Get the order by string required for collection fetching

protected final String
selectString(List<E> associations)

Generate a select list of columns containing all properties of the entity classes

public void
setAliases(String[] aliases)

public void
setCollectionOwners(int[] collectionOwners)

public void
public void
setCollectionSuffixes(String[] collectionSuffixes)

public void
setOwnerAssociationTypes(EntityType[] ownerAssociationType)

public void
setOwners(int[] owners)

public void
setPersisters(Loadable[] persisters)

public void
public void
setSuffixes(String[] suffixes)

protected final void
walkCollectionTree(QueryableCollection persister, String alias)

For a collection role, return a list of associations to be fetched by outerjoin

private void
walkCollectionTree(final QueryableCollection persister, final String alias, final PropertyPath path, final int currentDepth)

For a collection role, return a list of associations to be fetched by outerjoin

private void
walkComponentTree(final CompositeType
The component type to be walked.
componentType
,
final int
The property number for the component property (relative to persister).
propertyNumber
,
int
todo unknown
begin
,
final OuterJoinLoadable
The owner of the component property
persister
,
final String
The root alias
alias
,
final PropertyPath
The property access path
path
,
final int
The current join depth
currentDepth
)

For a component, add to a list of associations to be fetched by outerjoin

private void
walkCompositeElementTree(final CompositeType compositeType, final String[] cols, final QueryableCollection persister, final String alias, final PropertyPath path, final int currentDepth)

For a composite element, add to a list of associations to be fetched by outerjoin

private void
walkEntityAssociationTree(final AssociationType
The type representing the association to be processed.
associationType
,
final OuterJoinLoadable
The owner of the association to be processed.
persister
,
final int
The property number for the association (relative to the persister).
propertyNumber
,
final String
The entity alias
alias
,
final PropertyPath
The path to the association
path
,
final boolean
is the association nullable (which I think is supposed to indicate inner/outer join semantics).
nullable
,
final int
The current join depth
currentDepth
)

Process a particular association owned by the entity

protected final void
walkEntityTree(OuterJoinLoadable
The persister representing the entity to be walked.
persister
,
String
The (root) alias to use for this entity/persister.
alias
)

Walk the association tree for an entity, adding associations which should be join fetched to the associations inst var.

private void
walkEntityTree(final OuterJoinLoadable
The persister representing the entity to be walked.
persister
,
final String
The (root) alias to use for this entity/persister.
alias
,
final PropertyPath
The property path to the entity being walked
path
,
final int
The current join depth
currentDepth
)

Walk the association tree for an entity, adding associations which should be join fetched to the associations inst var.

protected StringBuilder
whereString(String alias, String[] columnNames, int batchSize)

Render the where condition for a (batch) load by identifier / collection key

protected StringBuilder
whereString(String alias, String[] columnNames, boolean[] valueNullnes, int batchSize)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

aliasesback to summary
protected String[] aliases
associationsback to summary
protected final List<E> associations
collectionOwnersback to summary
protected int[] collectionOwners
collectionPersistersback to summary
protected CollectionPersister[] collectionPersisters
collectionSuffixesback to summary
protected String[] collectionSuffixes
factoryback to summary
private final SessionFactoryImplementor factory

Deprecated

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

loadQueryInfluencersback to summary
private final LoadQueryInfluencers loadQueryInfluencers
lockModeArrayback to summary
protected LockMode[] lockModeArray
lockOptionsback to summary
protected LockOptions lockOptions
ownerAssociationTypesback to summary
protected EntityType[] ownerAssociationTypes
ownersback to summary
protected int[] owners
persistersback to summary
protected Loadable[] persisters
sqlback to summary
protected String sql
suffixesback to summary
protected String[] suffixes
visitedAssociationKeysback to summary
private final Set<E> visitedAssociationKeys

Constructor Detail

JoinWalkerback to summary
protected JoinWalker(SessionFactoryImplementor factory, LoadQueryInfluencers loadQueryInfluencers)

Deprecated

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

Method Detail

addAssociationToJoinTreeback to summary
private void addAssociationToJoinTree(final AssociationType type, final String[] aliasedLhsColumns, final String alias, final PropertyPath path, final int currentDepth, final JoinType joinType) throws MappingException

Add on association (one-to-one, many-to-one, or a collection) to a list of associations to be fetched by outerjoin

addAssociationToJoinTreeIfNecessaryback to summary
private void addAssociationToJoinTreeIfNecessary(final AssociationType type, final String[] aliasedLhsColumns, final String alias, final PropertyPath path, int currentDepth, final JoinType joinType) throws MappingException

Add on association (one-to-one, many-to-one, or a collection) to a list of associations to be fetched by outerjoin (if necessary)

countCollectionPersistersback to summary
protected static int countCollectionPersisters(List<E> associations) throws MappingException

Count the number of instances of Joinable which are actually also instances of PersistentCollection which are being fetched by outer join

countEntityPersistersback to summary
protected static int countEntityPersisters(List<E> associations) throws MappingException

Count the number of instances of Joinable which are actually also instances of Loadable, or are one-to-many associations

generateRootAliasback to summary
protected String generateRootAlias(final String description)
generateTableAliasback to summary
protected String generateTableAlias(final int n, final PropertyPath path, final Joinable joinable)
getAliasesback to summary
public String[] getAliases()
getAssociationsback to summary
public List<E> getAssociations()
getCollectionOwnersback to summary
public int[] getCollectionOwners()
getCollectionPersistersback to summary
public CollectionPersister[] getCollectionPersisters()
getCollectionSuffixesback to summary
public String[] getCollectionSuffixes()
getDialectback to summary
protected Dialect getDialect()
getFactoryback to summary
protected SessionFactoryImplementor getFactory()

Deprecated

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

getJoinTypeback to summary
protected JoinType getJoinType(OuterJoinLoadable persister, final PropertyPath path, int propertyNumber, AssociationType associationType, FetchMode metadataFetchMode, CascadeStyle metadataCascadeStyle, String lhsTable, String[] lhsColumns, final boolean nullable, final int currentDepth) throws MappingException

Determine the appropriate type of join (if any) to use to fetch the given association.

Parameters
persister:OuterJoinLoadable

The owner of the association.

path:PropertyPath

The path to the association

propertyNumber:int

The property number representing the association.

associationType:AssociationType

The association type.

metadataFetchMode:FetchMode

The metadata-defined fetch mode.

metadataCascadeStyle:CascadeStyle

The metadata-defined cascade style.

lhsTable:String

The owner table

lhsColumns:String[]

The owner join columns

nullable:boolean

Is the association nullable.

currentDepth:int

Current join depth

Returns:JoinType

type of join to use (org.hibernate.sql.JoinType#INNER_JOIN, org.hibernate.sql.JoinType#LEFT_OUTER_JOIN, or -1 to indicate no joining.

Exceptions
MappingException:
??
getJoinTypeback to summary
protected JoinType getJoinType(AssociationType associationType, FetchMode config, PropertyPath path, String lhsTable, String[] lhsColumns, boolean nullable, int currentDepth, CascadeStyle cascadeStyle) throws MappingException

Determine the appropriate associationType of join (if any) to use to fetch the given association.

Parameters
associationType:AssociationType

The association associationType.

config:FetchMode

The metadata-defined fetch mode.

path:PropertyPath

The path to the association

lhsTable:String

The owner table

lhsColumns:String[]

The owner join columns

nullable:boolean

Is the association nullable.

currentDepth:int

Current join depth

cascadeStyle:CascadeStyle

The metadata-defined cascade style.

Returns:JoinType

type of join to use (org.hibernate.sql.JoinType#INNER_JOIN, org.hibernate.sql.JoinType#LEFT_OUTER_JOIN, or -1 to indicate no joining.

Exceptions
MappingException:
??
getJoinTypeback to summary
protected JoinType getJoinType(boolean nullable, int currentDepth)

Use an inner join if it is a non-null association and this is the "first" join in a series

getLoadQueryInfluencersback to summary
public LoadQueryInfluencers getLoadQueryInfluencers()
getLockModeArrayback to summary
public LockMode[] getLockModeArray()
getLockModeOptionsback to summary
public LockOptions getLockModeOptions()
getOwnerAssociationTypesback to summary
public EntityType[] getOwnerAssociationTypes()
getOwnersback to summary
public int[] getOwners()
getPersistersback to summary
public Loadable[] getPersisters()
getSQLStringback to summary
public String getSQLString()
getSuffixesback to summary
public String[] getSuffixes()
getWithClauseback to summary
protected String getWithClause(PropertyPath path)
hasRestrictionback to summary
protected boolean hasRestriction(PropertyPath path)
initPersistersback to summary
protected void initPersisters(final List<E> associations, final LockMode lockMode) throws MappingException
initPersistersback to summary
protected void initPersisters(final List<E> associations, final LockOptions lockOptions) throws MappingException
initPersistersback to summary
protected void initPersisters(final List<E> associations, final LockOptions lockOptions, final JoinWalker.AssociationInitCallback callback) throws MappingException
isDuplicateAssociationback to summary
protected boolean isDuplicateAssociation(final String foreignKeyTable, final String[] foreignKeyColumns)

Used to detect circularities in the joined graph, note that this method is side-effecty

isDuplicateAssociationback to summary
protected boolean isDuplicateAssociation(final String lhsTable, final String[] lhsColumnNames, final AssociationType type)

Used to detect circularities in the joined graph, note that this method is side-effecty

isJoinableback to summary
protected boolean isJoinable(final JoinType joinType, final Set<E> visitedAssociationKeys, final String lhsTable, final String[] lhsColumnNames, final AssociationType type, final int depth)

Should we join this association?

isJoinedFetchEnabledback to summary
protected boolean isJoinedFetchEnabled(AssociationType type, FetchMode config, CascadeStyle cascadeStyle)

Override on subclasses to enable or suppress joining of certain association types

isJoinedFetchEnabledInMappingback to summary
protected boolean isJoinedFetchEnabledInMapping(FetchMode config, AssociationType type) throws MappingException

Does the mapping, and Hibernate default semantics, specify that this association should be fetched by outer joining

isTooDeepback to summary
protected boolean isTooDeep(int currentDepth)
isTooManyCollectionsback to summary
protected boolean isTooManyCollections()
mergeOrderingsback to summary
protected static String mergeOrderings(String ordering1, String ordering2)
mergeOuterJoinsback to summary
protected final JoinFragment mergeOuterJoins(List<E> associations) throws MappingException

Generate a sequence of LEFT OUTER JOIN clauses for the given associations.

orderByback to summary
protected String orderBy(final List<E> associations, final String orderBy)
orderByback to summary
protected static String orderBy(List<E> associations) throws MappingException

Get the order by string required for collection fetching

selectStringback to summary
protected final String selectString(List<E> associations) throws MappingException

Generate a select list of columns containing all properties of the entity classes

setAliasesback to summary
public void setAliases(String[] aliases)
setCollectionOwnersback to summary
public void setCollectionOwners(int[] collectionOwners)
setCollectionPersistersback to summary
public void setCollectionPersisters(CollectionPersister[] collectionPersisters)
setCollectionSuffixesback to summary
public void setCollectionSuffixes(String[] collectionSuffixes)
setOwnerAssociationTypesback to summary
public void setOwnerAssociationTypes(EntityType[] ownerAssociationType)
setOwnersback to summary
public void setOwners(int[] owners)
setPersistersback to summary
public void setPersisters(Loadable[] persisters)
setSqlback to summary
public void setSql(String sql)
setSuffixesback to summary
public void setSuffixes(String[] suffixes)
walkCollectionTreeback to summary
protected final void walkCollectionTree(QueryableCollection persister, String alias) throws MappingException

For a collection role, return a list of associations to be fetched by outerjoin

walkCollectionTreeback to summary
private void walkCollectionTree(final QueryableCollection persister, final String alias, final PropertyPath path, final int currentDepth) throws MappingException

For a collection role, return a list of associations to be fetched by outerjoin

walkComponentTreeback to summary
private void walkComponentTree(final CompositeType componentType, final int propertyNumber, int begin, final OuterJoinLoadable persister, final String alias, final PropertyPath path, final int currentDepth) throws MappingException

For a component, add to a list of associations to be fetched by outerjoin

Parameters
componentType:CompositeType

The component type to be walked.

propertyNumber:int

The property number for the component property (relative to persister).

begin:int

todo unknown

persister:OuterJoinLoadable

The owner of the component property

alias:String

The root alias

path:PropertyPath

The property access path

currentDepth:int

The current join depth

Exceptions
MappingException:
???
walkCompositeElementTreeback to summary
private void walkCompositeElementTree(final CompositeType compositeType, final String[] cols, final QueryableCollection persister, final String alias, final PropertyPath path, final int currentDepth) throws MappingException

For a composite element, add to a list of associations to be fetched by outerjoin

walkEntityAssociationTreeback to summary
private void walkEntityAssociationTree(final AssociationType associationType, final OuterJoinLoadable persister, final int propertyNumber, final String alias, final PropertyPath path, final boolean nullable, final int currentDepth) throws MappingException

Process a particular association owned by the entity

Parameters
associationType:AssociationType

The type representing the association to be processed.

persister:OuterJoinLoadable

The owner of the association to be processed.

propertyNumber:int

The property number for the association (relative to the persister).

alias:String

The entity alias

path:PropertyPath

The path to the association

nullable:boolean

is the association nullable (which I think is supposed to indicate inner/outer join semantics).

currentDepth:int

The current join depth

Exceptions
MappingException:
???
walkEntityTreeback to summary
protected final void walkEntityTree(OuterJoinLoadable persister, String alias) throws MappingException

Walk the association tree for an entity, adding associations which should be join fetched to the associations inst var. This form is the entry point into the walking for a given entity, starting the recursive calls into walkEntityTree(org.hibernate.persister.entity.OuterJoinLoadable, String, PropertyPath, int).

Parameters
persister:OuterJoinLoadable

The persister representing the entity to be walked.

alias:String

The (root) alias to use for this entity/persister.

Exceptions
MappingException:
???
walkEntityTreeback to summary
private void walkEntityTree(final OuterJoinLoadable persister, final String alias, final PropertyPath path, final int currentDepth) throws MappingException

Walk the association tree for an entity, adding associations which should be join fetched to the associations inst var. This form is the entry point into the walking for a given entity, starting the recursive calls into walkEntityTree(org.hibernate.persister.entity.OuterJoinLoadable, String, PropertyPath, int).

Parameters
persister:OuterJoinLoadable

The persister representing the entity to be walked.

alias:String

The (root) alias to use for this entity/persister.

path:PropertyPath

The property path to the entity being walked

currentDepth:int

The current join depth

Exceptions
MappingException:
???
whereStringback to summary
protected StringBuilder whereString(String alias, String[] columnNames, int batchSize)

Render the where condition for a (batch) load by identifier / collection key

whereStringback to summary
protected StringBuilder whereString(String alias, String[] columnNames, boolean[] valueNullnes, int batchSize)
org.hibernate.loader back to summary

protected Interface JoinWalker.AssociationInitCallback

Known Direct Implementers
org.hibernate.loader.entity.EntityJoinWalker.AssociationInitCallbackImpl

Field Summary

Modifier and TypeField and Description
public static final JoinWalker.AssociationInitCallback

Method Summary

Modifier and TypeMethod and Description
public void

Field Detail

NO_CALLBACKback to summary
public static final JoinWalker.AssociationInitCallback NO_CALLBACK

Method Detail

associationProcessedback to summary
public void associationProcessed(OuterJoinableAssociation oja, int position)
org.hibernate.loader back to summary

private final Class JoinWalker.AssociationKey

extends Object
Class Inheritance

Uniquely identifier a foreign key, so that we don't join it more than once, and create circularities

Field Summary

Modifier and TypeField and Description
private String[]
private String

Constructor Summary

AccessConstructor and Description
private
AssociationKey(String[] columns, String table)

Method Summary

Modifier and TypeMethod and Description
public boolean
equals(Object
the reference object with which to compare.
other
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.
public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for the object.
Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAlltoStringwaitwaitwait

Field Detail

columnsback to summary
private String[] columns
tableback to summary
private String table

Constructor Detail

AssociationKeyback to summary
private AssociationKey(String[] columns, String table)

Method Detail

equalsback to summary
public boolean equals(Object other)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
other:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object.

Annotations
@Override