java.lang.IllegalStateException: cannot generate an EntityKey when id is null.

Hot problem!
This exception has a lot of traffic. You can help 17 users by writing a short tip.

Searched on Google with the first line of a JAVA stack trace?

We can recommend more relevant solutions and speed up debugging when you paste your entire stack trace with the exception message. Try a sample exception.

Recommended solutions based on your search

Solutions on the web

java.lang.IllegalStateException: cannot generate an EntityKey when id is null.
at org.hibernate.engine.spi.EntityEntry.getEntityKey(EntityEntry.java:254)
at org.hibernate.event.internal.DefaultEvictEventListener.onEvict(DefaultEvictEventListener.java:95)
at org.hibernate.internal.SessionImpl.fireEvict(SessionImpl.java:1210)
at org.hibernate.internal.SessionImpl.evict(SessionImpl.java:1203)
at org.grails.orm.hibernate.GrailsHibernateTemplate$8.doInHibernate(GrailsHibernateTemplate.java:327)
at org.grails.orm.hibernate.GrailsHibernateTemplate.doExecute(GrailsHibernateTemplate.java:196)
at org.grails.orm.hibernate.GrailsHibernateTemplate.evict(GrailsHibernateTemplate.java:325)
at org.grails.orm.hibernate.AbstractHibernateGormInstanceApi.discard(AbstractHibernateGormInstanceApi.groovy:179)
at org.grails.datastore.gorm.GormEntity$Trait$Helper.discard(GormEntity.groovy:180)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at grails.plugin.springsecurity.ui.RegistrationCode.discard(RegistrationCode.groovy)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at grails.plugin.springsecurity.ui.SpringSecurityUiService.rollbackAndDiscard(SpringSecurityUiService.groovy:545)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:210)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:59)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:52)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:154)
at grails.plugin.springsecurity.ui.SpringSecurityUiService.handleException(SpringSecurityUiService.groovy:534)
at grails.plugin.springsecurity.ui.strategy.DefaultErrorsStrategy.handleException(DefaultErrorsStrategy.groovy:35)
at grails.plugin.springsecurity.ui.strategy.ErrorsStrategy$handleException.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at grails.plugin.springsecurity.ui.SpringSecurityUiService.save(SpringSecurityUiService.groovy:636)
at grails.plugin.springsecurity.ui.SpringSecurityUiService.save(SpringSecurityUiService.groovy)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:210)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:59)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:52)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:154)
at grails.plugin.springsecurity.ui.SpringSecurityUiService.$tt__register(SpringSecurityUiService.groovy:181)
at grails.plugin.springsecurity.ui.SpringSecurityUiService$_register_closure17.doCall(SpringSecurityUiService.groovy)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1024)
at groovy.lang.Closure.call(Closure.java:414)
at groovy.lang.Closure.call(Closure.java:430)
at grails.transaction.GrailsTransactionTemplate.execute(GrailsTransactionTemplate.groovy:93)
at grails.plugin.springsecurity.ui.SpringSecurityUiService.register(SpringSecurityUiService.groovy)
at grails.plugin.springsecurity.ui.strategy.DefaultRegistrationCodeStrategy.register(DefaultRegistrationCodeStrategy.groovy:40)
at grails.plugin.springsecurity.ui.strategy.RegistrationCodeStrategy$register$0.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at grails.plugin.springsecurity.ui.RegisterController.register(RegisterController.groovy:55)
at hvpermit.RegisterController.register(RegisterController.groovy)
at grails.plugin.springsecurity.ui.RegisterController.register(RegisterController.groovy)
at hvpermit.RegisterController.register(RegisterController.groovy)

Users with the same issue

You are the first who have seen this exception.

Write tip

Know the solutions? Share your knowledge to help other developers to debug faster.