»

Hibernate Core errors

An object-relational mapping tool for Java

http://hibernate.org/
Solution coverage:
Summary coverage:

Top patterns

  1. Cannot load lazy property after session is closed

    Refactor your code. Easiest is to change fetch = FetchType.LAZY to fetch = EAGER and optimize later.

    If it is not possible, make sure to fetch the property in the same transaction.

  2. Suspicious operation on a row in batch

    This happens in multiple cases when executing a batch query:

    • updating the same row more than once in a transaction
    • updating a row by id that does not exist
    • deleting a row by id that does not exist
  3. Using mixed field-based and process-based access strategies
    No solution
Error patternsPackagesClassesMethodsExceptions
DescriptionException TypeEntry MethodWeb pages

Cannot load lazy property after session is closed

org.hibernate.LazyInitializationException
org.hibernate.proxy.AbstractLazyInitializer.initialize
224Web pages
1Solution
LazyInitializationExceptionAbstractLazyInitializer.initialize224

Suspicious operation on a row in batch

org.hibernate.StaleStateException
1 frames hidden
org.hibernate.jdbc.Expectations$BasicExpectation.verifyOutcome
157Web pages
1Solution
StaleStateExceptionExpectations$BasicExpectation.verifyOutcome157

Using mixed field-based and process-based access strategies

org.hibernate.MappingException
org.hibernate.mapping.SimpleValue.getType
143Web pages
MappingExceptionSimpleValue.getType143

Two transactions concurrently modified the same entity

org.hibernate.StaleObjectStateException
org.hibernate.persister.entity.AbstractEntityPersister.check
120Web pages
StaleObjectStateExceptionAbstractEntityPersister.check120

Constraint violation

org.hibernate.exception.ConstraintViolationException
org.hibernate.exception.SQLStateConverter.convert
113Web pages
1Solution
ConstraintViolationExceptionSQLStateConverter.convert113

Missing mapping

org.hibernate.MappingException
org.hibernate.impl.SessionFactoryImpl.getEntityPersister
108Web pages
MappingExceptionSessionFactoryImpl.getEntityPersister108

Property name mismatch

org.hibernate.QueryException
org.hibernate.persister.entity.AbstractPropertyMapping.propertyException
94Web pages
1Solution
QueryExceptionAbstractPropertyMapping.propertyException94

Cannot map a JDBC type to hibernate type

org.hibernate.MappingException
1 frames hidden
org.hibernate.dialect.TypeNames.get
84Web pages
1Solution
MappingExceptionTypeNames.get84

HQL syntax error

org.hibernate.hql.ast.QuerySyntaxException
org.hibernate.hql.ast.QuerySyntaxException.convert
79Web pages
1Solution
QuerySyntaxExceptionQuerySyntaxException.convert79

Missing mapping

org.hibernate.MappingException
org.hibernate.internal.SessionFactoryImpl.getEntityPersister
79Web pages
1Solution
MappingExceptionSessionFactoryImpl.getEntityPersister79

HQL syntax error

org.hibernate.hql.internal.ast.QuerySyntaxException
org.hibernate.hql.internal.ast.QuerySyntaxException.convert
73Web pages
1Solution
QuerySyntaxExceptionQuerySyntaxException.convert73

HQL syntax error - bad table name

org.hibernate.hql.ast.QuerySyntaxException
org.hibernate.hql.ast.util.SessionFactoryHelper.requireClassPersister
69Web pages
1Solution
QuerySyntaxExceptionSessionFactoryHelper.requireClassPersister69

Session is closed

org.hibernate.SessionException
org.hibernate.impl.AbstractSessionImpl.errorIfClosed
68Web pages
1Solution
SessionExceptionAbstractSessionImpl.errorIfClosed68

Concurrent usage of a session

org.hibernate.service.UnknownServiceException
org.hibernate.service.internal.AbstractServiceRegistryImpl.getService
63Web pages
1Solution
UnknownServiceExceptionAbstractServiceRegistryImpl.getService63

Dialect configuration missing

org.hibernate.HibernateException
org.hibernate.engine.jdbc.dialect.internal.DialectFactoryImpl.determineDialect
63Web pages
1Solution
HibernateExceptionDialectFactoryImpl.determineDialect63

Hibernate could not find a config file

org.hibernate.HibernateException
org.hibernate.util.ConfigHelper.getResourceAsStream
62Web pages
1Solution
HibernateExceptionConfigHelper.getResourceAsStream62

Object references an unsaved transient instance

org.hibernate.TransientObjectException
org.hibernate.engine.ForeignKeys.getEntityIdentifierIfNotUnsaved
61Web pages
1Solution
TransientObjectExceptionForeignKeys.getEntityIdentifierIfNotUnsaved61

Foreign non-null entity is not saved

org.hibernate.PropertyValueException
org.hibernate.engine.Nullability.checkNullability
58Web pages
PropertyValueExceptionNullability.checkNullability58

Unable to persist object to database due to Entity/Bean field constraint violation

javax.validation.ConstraintViolationException
org.hibernate.cfg.beanvalidation.BeanValidationEventListener.validate
58Web pages
1Solution
ConstraintViolationExceptionBeanValidationEventListener.validate58

Incorrect Hibernate dependencies

java.lang.NoSuchMethodError
org.hibernate.cfg.annotations.EntityBinder.processComplementaryTableDefinitions
57Web pages
1Solution
NoSuchMethodErrorEntityBinder.processComplementaryTableDefinitions57

Not setting a value to the non-null field of Entity

org.hibernate.AssertionFailure
org.hibernate.event.def.DefaultFlushEntityEventListener.checkId
57Web pages
AssertionFailureDefaultFlushEntityEventListener.checkId57

Persisting an entity which is not in persistant state

org.hibernate.PersistentObjectException
org.hibernate.event.internal.DefaultPersistEventListener.onPersist
56Web pages
1Solution
PersistentObjectExceptionDefaultPersistEventListener.onPersist56

Config file not found in classpath

org.hibernate.MappingNotFoundException
org.hibernate.cfg.Configuration.addResource
53Web pages
MappingNotFoundExceptionConfiguration.addResource53

Could not load jdbc driver

java.lang.ClassNotFoundException
org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl$AggregatedClassLoader.findClass
46Web pages
ClassNotFoundExceptionClassLoaderServiceImpl$AggregatedClassLoader.findClass46

SqlExceptionHelper.convert() has thrown a GenericJDBCException

org.hibernate.exception.GenericJDBCException
1 frames hidden
org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert
45Web pages
GenericJDBCExceptionSqlExceptionHelper.convert45

Using same @Column name more than once while mapping columns to entity properties

org.hibernate.MappingException
org.hibernate.mapping.PersistentClass.checkColumnDuplication
45Web pages
1Solution
MappingExceptionPersistentClass.checkColumnDuplication45

Improper mapping

org.hibernate.HibernateException
org.hibernate.mapping.Table.validateColumns
44Web pages
1Solution
HibernateExceptionTable.validateColumns44

SQL syntax error

org.hibernate.exception.SQLGrammarException
org.hibernate.exception.internal.SQLStateConversionDelegate.convert
44Web pages
1Solution
SQLGrammarExceptionSQLStateConversionDelegate.convert44

Dialect not set

org.hibernate.HibernateException
org.hibernate.service.jdbc.dialect.internal.DialectFactoryImpl.determineDialect
43Web pages
1Solution
HibernateExceptionDialectFactoryImpl.determineDialect43

Hibernate session context is not set

org.hibernate.HibernateException
org.hibernate.impl.SessionFactoryImpl.getCurrentSession
42Web pages
HibernateExceptionSessionFactoryImpl.getCurrentSession42

Incorrect mapping in annotations

org.hibernate.AnnotationException
org.hibernate.cfg.annotations.CollectionBinder.bindStarToManySecondPass
41Web pages
AnnotationExceptionCollectionBinder.bindStarToManySecondPass41

Persist multiple entities with same Id

org.hibernate.NonUniqueObjectException
org.hibernate.engine.StatefulPersistenceContext.checkUniqueness
40Web pages
1Solution
NonUniqueObjectExceptionStatefulPersistenceContext.checkUniqueness40

Property name mismatch for getter

org.hibernate.PropertyNotFoundException
1 frames hidden
org.hibernate.property.BasicPropertyAccessor.getGetter
40Web pages
1Solution
PropertyNotFoundExceptionBasicPropertyAccessor.getGetter40

Missing dependency for strategy

org.hibernate.boot.registry.selector.spi.StrategySelectionException
org.hibernate.boot.registry.selector.internal.StrategySelectorImpl.selectStrategyImplementor
40Web pages
1Solution
StrategySelectionExceptionStrategySelectorImpl.selectStrategyImplementor40

HQL syntax error

org.hibernate.HibernateException
1 frames hidden
org.hibernate.cfg.Configuration.buildSessionFactory
37Web pages
1Solution
HibernateExceptionConfiguration.buildSessionFactory37

No jta platform specified

java.lang.NullPointerException
org.hibernate.engine.transaction.internal.jta.JtaStatusHelper.getStatus
36Web pages
1Solution
NullPointerExceptionJtaStatusHelper.getStatus36

AbstractBatcher.executeBatch() has thrown a BatchUpdateException

java.sql.BatchUpdateException
3 frames hidden
org.hibernate.jdbc.AbstractBatcher.executeBatch
36Web pages
BatchUpdateExceptionAbstractBatcher.executeBatch36

Missing hibernate annotation dependency

org.hibernate.MappingException
1 frames hidden
org.hibernate.cfg.Configuration.parseSessionFactory
36Web pages
MappingExceptionConfiguration.parseSessionFactory36

ConnectionManager.openConnection() has thrown a GenericJDBCException

org.hibernate.exception.GenericJDBCException
4 frames hidden
org.hibernate.jdbc.ConnectionManager.openConnection
35Web pages
GenericJDBCExceptionConnectionManager.openConnection35

Transaction initiation is missing

org.hibernate.HibernateException
org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke
34Web pages
HibernateExceptionThreadLocalSessionContext$TransactionProtectionWrapper.invoke34

Missing mapping for collection entity

org.hibernate.AnnotationException
org.hibernate.cfg.annotations.CollectionBinder.bindManyToManySecondPass
34Web pages
1Solution
AnnotationExceptionCollectionBinder.bindManyToManySecondPass34

Cannot commit transaction

org.hibernate.TransactionException
org.hibernate.transaction.JDBCTransaction.commit
33Web pages
1Solution
TransactionExceptionJDBCTransaction.commit33

Not-null constraint violation

org.hibernate.PropertyValueException
org.hibernate.engine.internal.Nullability.checkNullability
33Web pages
1Solution
PropertyValueExceptionNullability.checkNullability33

Missing mapping for foreign key

org.hibernate.MappingException
org.hibernate.cfg.Configuration.secondPassCompileForeignKeys
33Web pages
1Solution
MappingExceptionConfiguration.secondPassCompileForeignKeys33

Missing @Id annotation on entity

org.hibernate.AnnotationException
org.hibernate.cfg.InheritanceState.determineDefaultAccessType
32Web pages
AnnotationExceptionInheritanceState.determineDefaultAccessType32

HQL syntax error

java.lang.IllegalArgumentException
1 frames hidden
org.hibernate.hql.ast.QueryTranslatorImpl.parse
32Web pages
1Solution
IllegalArgumentExceptionQueryTranslatorImpl.parse32

ForeignKey.alignColumns() has thrown a MappingException

org.hibernate.MappingException
org.hibernate.mapping.ForeignKey.alignColumns
30Web pages
MappingExceptionForeignKey.alignColumns30

Suspicious operation on a row

org.hibernate.StaleStateException
org.hibernate.jdbc.BatchingBatcher.checkRowCount
30Web pages
1Solution
StaleStateExceptionBatchingBatcher.checkRowCount30

Hibernate connection URL missing in config file

java.lang.UnsupportedOperationException
org.hibernate.connection.UserSuppliedConnectionProvider.getConnection
30Web pages
UnsupportedOperationExceptionUserSuppliedConnectionProvider.getConnection30

ActionQueue.executeActions() has thrown a GenericJDBCException

org.hibernate.exception.GenericJDBCException
4 frames hidden
org.hibernate.engine.ActionQueue.executeActions
28Web pages
GenericJDBCExceptionActionQueue.executeActions28
Nothing to list here.
Nothing to list here.
Nothing to list here.
Nothing to list here.