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

Stack Overflow | Graham H | 8 months ago
tip
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.

Root Cause Analysis

  1. java.lang.IllegalStateException

    cannot generate an EntityKey when id is null.

    at org.hibernate.engine.spi.EntityEntry.getEntityKey()
  2. Hibernate
    SessionImpl.evict
    1. org.hibernate.engine.spi.EntityEntry.getEntityKey(EntityEntry.java:254)
    2. org.hibernate.event.internal.DefaultEvictEventListener.onEvict(DefaultEvictEventListener.java:95)
    3. org.hibernate.internal.SessionImpl.fireEvict(SessionImpl.java:1210)
    4. org.hibernate.internal.SessionImpl.evict(SessionImpl.java:1203)
    4 frames
  3. Grails GORM
    AbstractHibernateGormInstanceApi.discard
    1. org.grails.orm.hibernate.GrailsHibernateTemplate$8.doInHibernate(GrailsHibernateTemplate.java:327)
    2. org.grails.orm.hibernate.GrailsHibernateTemplate.doExecute(GrailsHibernateTemplate.java:196)
    3. org.grails.orm.hibernate.GrailsHibernateTemplate.evict(GrailsHibernateTemplate.java:325)
    4. org.grails.orm.hibernate.AbstractHibernateGormInstanceApi.discard(AbstractHibernateGormInstanceApi.groovy:179)
    4 frames
  4. Grails GORM
    GormEntity$Trait$Helper$discard$3.call
    1. org.grails.datastore.gorm.GormEntity$Trait$Helper.discard(GormEntity.groovy:180)
    2. org.grails.datastore.gorm.GormEntity$Trait$Helper$discard$3.call(Unknown Source)
    2 frames
  5. Groovy
    AbstractCallSite.call
    1. org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
    2. org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
    3. org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
    3 frames
  6. grails.plugin.springsecurity
    RegistrationCode.discard
    1. grails.plugin.springsecurity.ui.RegistrationCode.discard(RegistrationCode.groovy)
    1 frame
  7. Grails GORM
    GormEntity$discard$0.call
    1. org.grails.datastore.gorm.GormEntity$discard$0.call(Unknown Source)
    1 frame
  8. Groovy
    AbstractCallSite.call
    1. org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
    2. org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
    3. org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:117)
    3 frames
  9. grails.plugin.springsecurity
    SpringSecurityUiService.rollbackAndDiscard
    1. grails.plugin.springsecurity.ui.SpringSecurityUiService.rollbackAndDiscard(SpringSecurityUiService.groovy:545)
    1 frame
  10. Java RT
    Method.invoke
    1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    4. java.lang.reflect.Method.invoke(Method.java:498)
    4 frames
  11. Springloaded
    ReflectiveInterceptor.jlrMethodInvoke
    1. org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1426)
    1 frame
  12. Groovy
    AbstractCallSite.callCurrent
    1. org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:210)
    2. org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:59)
    3. org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:52)
    4. org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:154)
    5. org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:174)
    5 frames
  13. grails.plugin.springsecurity
    ErrorsStrategy$handleException.call
    1. grails.plugin.springsecurity.ui.SpringSecurityUiService.handleException(SpringSecurityUiService.groovy:534)
    2. grails.plugin.springsecurity.ui.strategy.DefaultErrorsStrategy.handleException(DefaultErrorsStrategy.groovy:35)
    3. grails.plugin.springsecurity.ui.strategy.ErrorsStrategy$handleException.call(Unknown Source)
    3 frames
  14. Groovy
    AbstractCallSite.call
    1. org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
    2. org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
    2 frames
  15. grails.plugin.springsecurity
    SpringSecurityUiService.save
    1. grails.plugin.springsecurity.ui.SpringSecurityUiService.save(SpringSecurityUiService.groovy:636)
    2. grails.plugin.springsecurity.ui.SpringSecurityUiService.save(SpringSecurityUiService.groovy)
    2 frames
  16. Java RT
    Method.invoke
    1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    4. java.lang.reflect.Method.invoke(Method.java:498)
    4 frames
  17. Springloaded
    ReflectiveInterceptor.jlrMethodInvoke
    1. org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1426)
    1 frame
  18. Groovy
    AbstractCallSite.callCurrent
    1. org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:210)
    2. org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:59)
    3. org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:52)
    4. org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:154)
    5. org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:190)
    5 frames
  19. grails.plugin.springsecurity
    SpringSecurityUiService$_register_closure17.doCall
    1. grails.plugin.springsecurity.ui.SpringSecurityUiService.$tt__register(SpringSecurityUiService.groovy:181)
    2. grails.plugin.springsecurity.ui.SpringSecurityUiService$_register_closure17.doCall(SpringSecurityUiService.groovy)
    2 frames
  20. Java RT
    Method.invoke
    1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    4. java.lang.reflect.Method.invoke(Method.java:498)
    4 frames
  21. Springloaded
    ReflectiveInterceptor.jlrMethodInvoke
    1. org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1426)
    1 frame
  22. Groovy
    Closure.call
    1. org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
    2. groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
    3. org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294)
    4. groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1024)
    5. groovy.lang.Closure.call(Closure.java:414)
    6. groovy.lang.Closure.call(Closure.java:430)
    6 frames
  23. Grails
    GrailsTransactionTemplate$2.doInTransaction
    1. grails.transaction.GrailsTransactionTemplate$2.doInTransaction(GrailsTransactionTemplate.groovy:96)
    1 frame
  24. Spring Tx
    TransactionTemplate.execute
    1. org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133)
    1 frame
  25. Grails
    GrailsTransactionTemplate.execute
    1. grails.transaction.GrailsTransactionTemplate.execute(GrailsTransactionTemplate.groovy:93)
    1 frame
  26. grails.plugin.springsecurity
    RegistrationCodeStrategy$register$0.call
    1. grails.plugin.springsecurity.ui.SpringSecurityUiService.register(SpringSecurityUiService.groovy)
    2. grails.plugin.springsecurity.ui.strategy.DefaultRegistrationCodeStrategy.register(DefaultRegistrationCodeStrategy.groovy:40)
    3. grails.plugin.springsecurity.ui.strategy.RegistrationCodeStrategy$register$0.call(Unknown Source)
    3 frames
  27. Groovy
    AbstractCallSite.call
    1. org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
    2. org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
    3. org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:141)
    3 frames
  28. grails.plugin.springsecurity
    RegisterController.register
    1. grails.plugin.springsecurity.ui.RegisterController.register(RegisterController.groovy:55)
    1 frame
  29. hvpermit
    RegisterController.register
    1. hvpermit.RegisterController.register(RegisterController.groovy)
    1 frame
  30. grails.plugin.springsecurity
    RegisterController.register
    1. grails.plugin.springsecurity.ui.RegisterController.register(RegisterController.groovy)
    1 frame
  31. hvpermit
    RegisterController.register
    1. hvpermit.RegisterController.register(RegisterController.groovy)
    1 frame