Bug 1121674 - org.hibernate.PropertyValueException: not-null property references a null or transient value: org.candlepin.model.SourceSubscription.subscriptionSubKey
Summary: org.hibernate.PropertyValueException: not-null property references a null or ...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Candlepin
Classification: Community
Component: candlepin
Version: 0.9
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
: ---
Assignee: Bryan Kearney
QA Contact: Katello QA List
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-07-21 14:44 UTC by Dennis Crissman
Modified: 2015-05-14 14:53 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-10-21 14:01:39 UTC


Attachments (Terms of Use)

Description Dennis Crissman 2014-07-21 14:44:50 UTC
Getting this exception when attempting to attach subscriptions with stage_test_42. Here is the pool in question http://pastebin.test.redhat.com/222889

2014-07-21 10:11:21,126 [job=bind_by_pool_9eab955f-e62a-4ab8-b758-235e31154c0c, org=] ERROR org.candlepin.pinsetter.core.PinsetterJobListener - Job [bind_by_pool_9eab955f-e62a-4ab8-b758-235e31154c0c] failed.
org.quartz.JobExecutionException: org.hibernate.PropertyValueException: not-null property references a null or transient value: org.candlepin.model.SourceSubscription.subscriptionSubKey
	at org.candlepin.pinsetter.tasks.EntitlerJob.toExecute(EntitlerJob.java:69) ~[EntitlerJob.class:na]
	at org.candlepin.pinsetter.tasks.KingpinJob.execute(KingpinJob.java:74) ~[KingpinJob.class:na]
	at org.quartz.core.JobRunShell.run(Unknown Source) [quartz-2.1.5.jar:na]
	at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(Unknown Source) [quartz-2.1.5.jar:na]
Caused by: javax.persistence.PersistenceException: org.hibernate.PropertyValueException: not-null property references a null or transient value: org.candlepin.model.SourceSubscription.subscriptionSubKey
	at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1387) ~[hibernate-entitymanager-4.2.5.Final-redhat-1.jar:4.2.5.Final-redhat-1]
	at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1310) ~[hibernate-entitymanager-4.2.5.Final-redhat-1.jar:4.2.5.Final-redhat-1]
	at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1316) ~[hibernate-entitymanager-4.2.5.Final-redhat-1.jar:4.2.5.Final-redhat-1]
	at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:881) ~[hibernate-entitymanager-4.2.5.Final-redhat-1.jar:4.2.5.Final-redhat-1]
	at org.candlepin.model.AbstractHibernateCurator.save(AbstractHibernateCurator.java:357) ~[AbstractHibernateCurator.class:na]
	at org.candlepin.model.AbstractHibernateCurator.create(AbstractHibernateCurator.java:111) ~[AbstractHibernateCurator.class:na]
	at org.candlepin.model.PoolCurator.create(PoolCurator.java:376) ~[PoolCurator.class:na]
	at com.google.inject.persist.jpa.JpaLocalTxnInterceptor.invoke(JpaLocalTxnInterceptor.java:58) ~[guice-persist-3.0-redhat-1.jar:3.0-redhat-1]
	at org.candlepin.controller.CandlepinPoolManager.createPool(CandlepinPoolManager.java:423) ~[CandlepinPoolManager.class:na]
	at org.candlepin.policy.js.pool.PoolHelper.createHostRestrictedPool(PoolHelper.java:118) ~[PoolHelper.class:na]
	at org.candlepin.policy.js.entitlement.AbstractEntitlementRules.postBindVirtLimit(AbstractEntitlementRules.java:366) ~[AbstractEntitlementRules.class:na]
	at org.candlepin.policy.js.entitlement.AbstractEntitlementRules.runPostEntitlement(AbstractEntitlementRules.java:277) ~[AbstractEntitlementRules.class:na]
	at org.candlepin.policy.js.entitlement.AbstractEntitlementRules.postEntitlement(AbstractEntitlementRules.java:434) ~[AbstractEntitlementRules.class:na]
	at org.candlepin.controller.CandlepinPoolManager$NewHandler.handlePostEntitlement(CandlepinPoolManager.java:1268) ~[CandlepinPoolManager$NewHandler.class:na]
	at org.candlepin.controller.CandlepinPoolManager.addOrUpdateEntitlement(CandlepinPoolManager.java:813) ~[CandlepinPoolManager.class:na]
	at org.candlepin.controller.CandlepinPoolManager.entitleByPool(CandlepinPoolManager.java:750) ~[CandlepinPoolManager.class:na]
	at com.google.inject.persist.jpa.JpaLocalTxnInterceptor.invoke(JpaLocalTxnInterceptor.java:66) ~[guice-persist-3.0-redhat-1.jar:3.0-redhat-1]
	at org.candlepin.controller.Entitler.createEntitlementByPool(Entitler.java:94) ~[Entitler.class:na]
	at org.candlepin.controller.Entitler.bindByPool(Entitler.java:86) ~[Entitler.class:na]
	at org.candlepin.controller.Entitler.bindByPool(Entitler.java:67) ~[Entitler.class:na]
	at org.candlepin.pinsetter.tasks.EntitlerJob.toExecute(EntitlerJob.java:59) ~[EntitlerJob.class:na]
	... 3 common frames omitted
Caused by: org.hibernate.PropertyValueException: not-null property references a null or transient value: org.candlepin.model.SourceSubscription.subscriptionSubKey
	at org.hibernate.engine.internal.Nullability.checkNullability(Nullability.java:103) ~[hibernate-core-4.2.5.Final-redhat-1.jar:4.2.5.Final-redhat-1]
	at org.hibernate.action.internal.AbstractEntityInsertAction.nullifyTransientReferencesIfNotAlready(AbstractEntityInsertAction.java:132) ~[hibernate-core-4.2.5.Final-redhat-1.jar:4.2.5.Final-redhat-1]
	at org.hibernate.action.internal.AbstractEntityInsertAction.makeEntityManaged(AbstractEntityInsertAction.java:141) ~[hibernate-core-4.2.5.Final-redhat-1.jar:4.2.5.Final-redhat-1]
	at org.hibernate.engine.spi.ActionQueue.addResolvedEntityInsertAction(ActionQueue.java:220) ~[hibernate-core-4.2.5.Final-redhat-1.jar:4.2.5.Final-redhat-1]
	at org.hibernate.engine.spi.ActionQueue.addInsertAction(ActionQueue.java:194) ~[hibernate-core-4.2.5.Final-redhat-1.jar:4.2.5.Final-redhat-1]
	at org.hibernate.engine.spi.ActionQueue.addAction(ActionQueue.java:142) ~[hibernate-core-4.2.5.Final-redhat-1.jar:4.2.5.Final-redhat-1]
	at org.hibernate.event.internal.AbstractSaveEventListener.addInsertAction(AbstractSaveEventListener.java:329) ~[hibernate-core-4.2.5.Final-redhat-1.jar:4.2.5.Final-redhat-1]
	at org.hibernate.event.internal.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:286) ~[hibernate-core-4.2.5.Final-redhat-1.jar:4.2.5.Final-redhat-1]
	at org.hibernate.event.internal.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:192) ~[hibernate-core-4.2.5.Final-redhat-1.jar:4.2.5.Final-redhat-1]
	at org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:135) ~[hibernate-core-4.2.5.Final-redhat-1.jar:4.2.5.Final-redhat-1]
	at org.hibernate.ejb.event.EJB3PersistEventListener.saveWithGeneratedId(EJB3PersistEventListener.java:78) ~[hibernate-entitymanager-4.2.5.Final-redhat-1.jar:4.2.5.Final-redhat-1]
	at org.hibernate.event.internal.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:208) ~[hibernate-core-4.2.5.Final-redhat-1.jar:4.2.5.Final-redhat-1]
	at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:151) ~[hibernate-core-4.2.5.Final-redhat-1.jar:4.2.5.Final-redhat-1]
	at org.hibernate.internal.SessionImpl.firePersist(SessionImpl.java:843) ~[hibernate-core-4.2.5.Final-redhat-1.jar:4.2.5.Final-redhat-1]
	at org.hibernate.internal.SessionImpl.persist(SessionImpl.java:836) ~[hibernate-core-4.2.5.Final-redhat-1.jar:4.2.5.Final-redhat-1]
	at org.hibernate.ejb.engine.spi.EJB3CascadingAction$1.cascade(EJB3CascadingAction.java:53) ~[hibernate-entitymanager-4.2.5.Final-redhat-1.jar:4.2.5.Final-redhat-1]
	at org.hibernate.engine.internal.Cascade.cascadeToOne(Cascade.java:388) ~[hibernate-core-4.2.5.Final-redhat-1.jar:4.2.5.Final-redhat-1]
	at org.hibernate.engine.internal.Cascade.cascadeAssociation(Cascade.java:331) ~[hibernate-core-4.2.5.Final-redhat-1.jar:4.2.5.Final-redhat-1]
	at org.hibernate.engine.internal.Cascade.cascadeProperty(Cascade.java:209) ~[hibernate-core-4.2.5.Final-redhat-1.jar:4.2.5.Final-redhat-1]
	at org.hibernate.engine.internal.Cascade.cascade(Cascade.java:166) ~[hibernate-core-4.2.5.Final-redhat-1.jar:4.2.5.Final-redhat-1]
	at org.hibernate.event.internal.AbstractSaveEventListener.cascadeAfterSave(AbstractSaveEventListener.java:449) ~[hibernate-core-4.2.5.Final-redhat-1.jar:4.2.5.Final-redhat-1]
	at org.hibernate.event.internal.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:292) ~[hibernate-core-4.2.5.Final-redhat-1.jar:4.2.5.Final-redhat-1]
	at org.hibernate.event.internal.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:192) ~[hibernate-core-4.2.5.Final-redhat-1.jar:4.2.5.Final-redhat-1]
	at org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:135) ~[hibernate-core-4.2.5.Final-redhat-1.jar:4.2.5.Final-redhat-1]
	at org.hibernate.ejb.event.EJB3PersistEventListener.saveWithGeneratedId(EJB3PersistEventListener.java:78) ~[hibernate-entitymanager-4.2.5.Final-redhat-1.jar:4.2.5.Final-redhat-1]
	at org.hibernate.event.internal.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:208) ~[hibernate-core-4.2.5.Final-redhat-1.jar:4.2.5.Final-redhat-1]
	at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:151) ~[hibernate-core-4.2.5.Final-redhat-1.jar:4.2.5.Final-redhat-1]
	at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:78) ~[hibernate-core-4.2.5.Final-redhat-1.jar:4.2.5.Final-redhat-1]
	at org.hibernate.internal.SessionImpl.firePersist(SessionImpl.java:853) ~[hibernate-core-4.2.5.Final-redhat-1.jar:4.2.5.Final-redhat-1]
	at org.hibernate.internal.SessionImpl.persist(SessionImpl.java:827) ~[hibernate-core-4.2.5.Final-redhat-1.jar:4.2.5.Final-redhat-1]
	at org.hibernate.internal.SessionImpl.persist(SessionImpl.java:831) ~[hibernate-core-4.2.5.Final-redhat-1.jar:4.2.5.Final-redhat-1]
	at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:875) ~[hibernate-entitymanager-4.2.5.Final-redhat-1.jar:4.2.5.Final-redhat-1]
	... 20 common frames omitted

Comment 1 Carter Kozak 2014-07-22 16:31:08 UTC
commit 36dadc8b41547fada7b00869e89a694a4bf3f041
Author: ckozak <ckozak@redhat.com>
Date:   Mon Jul 21 15:15:42 2014 -0400

    1121674: Persist new entitlements to the database before post-ent
    
    The source entitlement was getting an ID set when it was flushed
    at a random point (because it was added to pool and consumer).
    This didn't always occur before we needed to read the entitlement
    ID in order to create a SourceSubscription entry with ent.id as
    subkey


Note You need to log in before you can comment on or make changes to this bug.