BDM One to Many Relationship

1
0
-1

Hi All,

We've created a simple BDM in which an Issue object can have 0, 1 or more Response objects (1-to-n). The Issue object has no reference to the Response object. OTOH, the Response object has a mandatory "issue" attribute of class Issue (Response have to point to a parent Issue object).

However, the BDM Manager creates a unique index for the Response object pointing to the Issue object. This model doesn't allow to add multiple responses for an issue:

org.h2.jdbc.JdbcSQLException: Unique index or primary key violation: "UK_HSYOB6R6TAGH8M6PGFYWCDS9P_INDEX_1 ON PUBLIC.RESPONSE(ISSUE_PID) VALUES ( /* 4 */ 1 )"; SQL statement:
insert into RESPONSE (persistenceId, ATTACHMENT, DATETIME, DIAGNOSTIC, ISSUE_PID, persistenceVersion, RESPONSE, RESPONSEACTION, USERID, USERNAME) values (null, ?, ?, ?, ?, ?, ?, ?, ?, ?)

How can we disable the creating of this unique constraint?

Thank you.

Comments

Submitted by antoine.mottier on Wed, 06/28/2017 - 11:21

Hi,

Can you share your process .bos file in order to reproduce the issue?

Thanks

Submitted by edo_2 on Wed, 06/28/2017 - 15:34

Antoine,

I changed the relationship adding a Response responses property to the Issue object. Now I get this error:

2017-06-28 09:30:54.992 -0400 SEVERE: org.bonitasoft.engine.execution.work.FailureHandlingBonitaWork THREAD_ID=103 | HOSTNAME=edo | TENANT_ID=1 | org.bonitasoft.engine.persistence.SRetryableException : "javax.persistence.PersistenceException: org.hibernate.PropertyValueException: not-null property references a null or transient value: com.r2r.meditrack.Response._responses_ISSUE_PIDBackref"
org.bonitasoft.engine.persistence.SRetryableException: javax.persistence.PersistenceException: org.hibernate.PropertyValueException: not-null property references a null or transient value: com.r2r.meditrack.Response._responses_ISSUE_PIDBackref
    at org.bonitasoft.engine.business.data.impl.JPABusinessDataRepositoryImpl.merge(JPABusinessDataRepositoryImpl.java:351)
    at org.bonitasoft.engine.operation.MergeEntityAction.execute(MergeEntityAction.java:41)
    at org.bonitasoft.engine.operation.EntitiesActionsExecutor.executeAction(EntitiesActionsExecutor.java:42)
    at org.bonitasoft.engine.operation.BusinessDataAssignmentStrategy.computeNewValueForLeftOperand(BusinessDataAssignmentStrategy.java:45)
    at org.bonitasoft.engine.core.operation.impl.OperationServiceImpl.calculateRightOperandValue(OperationServiceImpl.java:122)
    at org.bonitasoft.engine.core.operation.impl.OperationServiceImpl.executeOperators(OperationServiceImpl.java:105)
    at org.bonitasoft.engine.core.operation.impl.OperationServiceImpl.execute(OperationServiceImpl.java:94)
    at org.bonitasoft.engine.core.operation.impl.OperationServiceImpl.execute(OperationServiceImpl.java:81)
    at org.bonitasoft.engine.execution.StateBehaviors.executeOperations(StateBehaviors.java:560)
    at org.bonitasoft.engine.execution.state.ExecutingAutomaticActivityStateImpl.onEnterToOnFinish(ExecutingAutomaticActivityStateImpl.java:48)
    at org.bonitasoft.engine.execution.state.OnEnterAndFinishConnectorState.execute(OnEnterAndFinishConnectorState.java:67)
    at org.bonitasoft.engine.execution.state.OnEnterAndFinishConnectorState.execute(OnEnterAndFinishConnectorState.java:34)
    at org.bonitasoft.engine.execution.FlowNodeExecutorImpl.executeState(FlowNodeExecutorImpl.java:122)
    at org.bonitasoft.engine.execution.FlowNodeExecutorImpl.updateState(FlowNodeExecutorImpl.java:173)
    at org.bonitasoft.engine.execution.FlowNodeExecutorImpl.stepForward(FlowNodeExecutorImpl.java:157)
    at org.bonitasoft.engine.execution.FlowNodeExecutorImpl.executeFlowNode(FlowNodeExecutorImpl.java:300)
    at org.bonitasoft.engine.execution.work.ExecuteFlowNodeWork.work(ExecuteFlowNodeWork.java:89)
    at org.bonitasoft.engine.execution.work.TxBonitaWork$1.call(TxBonitaWork.java:48)
    at org.bonitasoft.engine.execution.work.TxBonitaWork$1.call(TxBonitaWork.java:44)
    at org.bonitasoft.engine.transaction.JTATransactionServiceImpl.executeInTransaction(JTATransactionServiceImpl.java:274)
    at org.bonitasoft.engine.execution.work.TxBonitaWork.work(TxBonitaWork.java:53)
    at org.bonitasoft.engine.execution.work.LockProcessInstanceWork.work(LockProcessInstanceWork.java:79)
    at org.bonitasoft.engine.execution.work.failurewrapping.TxInHandleFailureWrappingWork.work(TxInHandleFailureWrappingWork.java:42)
    at org.bonitasoft.engine.execution.work.failurewrapping.TxInHandleFailureWrappingWork.work(TxInHandleFailureWrappingWork.java:42)
    at org.bonitasoft.engine.execution.work.failurewrapping.TxInHandleFailureWrappingWork.work(TxInHandleFailureWrappingWork.java:42)
    at org.bonitasoft.engine.execution.work.FailureHandlingBonitaWork.work(FailureHandlingBonitaWork.java:66)
    at org.bonitasoft.engine.work.BonitaWork.run(BonitaWork.java:56)
    at org.bonitasoft.engine.work.SequenceRunnableExecutor.innerRun(SequenceRunnableExecutor.java:47)
    at org.bonitasoft.engine.work.BonitaRunnable.run(BonitaRunnable.java:35)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:748)
Caused by: javax.persistence.PersistenceException: org.hibernate.PropertyValueException: not-null property references a null or transient value: com.r2r.meditrack.Response._responses_ISSUE_PIDBackref
    at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1387)
    at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1310)
    at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1316)
    at org.hibernate.ejb.AbstractEntityManagerImpl.merge(AbstractEntityManagerImpl.java:898)
    at org.bonitasoft.engine.business.data.impl.JPABusinessDataRepositoryImpl.merge(JPABusinessDataRepositoryImpl.java:349)
    ... 31 more
Caused by: org.hibernate.PropertyValueException: not-null property references a null or transient value: com.r2r.meditrack.Response._responses_ISSUE_PIDBackref
    at org.hibernate.engine.internal.Nullability.checkNullability(Nullability.java:103)
    at org.hibernate.action.internal.AbstractEntityInsertAction.nullifyTransientReferencesIfNotAlready(AbstractEntityInsertAction.java:132)
    at org.hibernate.action.internal.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:69)
    at org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:395)
    at org.hibernate.engine.spi.ActionQueue.addResolvedEntityInsertAction(ActionQueue.java:229)
    at org.hibernate.engine.spi.ActionQueue.addInsertAction(ActionQueue.java:209)
    at org.hibernate.engine.spi.ActionQueue.addAction(ActionQueue.java:193)
    at org.hibernate.event.internal.AbstractSaveEventListener.addInsertAction(AbstractSaveEventListener.java:321)
    at org.hibernate.event.internal.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:286)
    at org.hibernate.event.internal.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:192)
    at org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:125)
    at org.hibernate.ejb.event.EJB3MergeEventListener.saveWithGeneratedId(EJB3MergeEventListener.java:71)
    at org.hibernate.event.internal.DefaultMergeEventListener.saveTransientEntity(DefaultMergeEventListener.java:236)
    at org.hibernate.event.internal.DefaultMergeEventListener.entityIsTransient(DefaultMergeEventListener.java:216)
    at org.hibernate.event.internal.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:154)
    at org.hibernate.event.internal.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:76)
    at org.hibernate.internal.SessionImpl.fireMerge(SessionImpl.java:833)
    at org.hibernate.internal.SessionImpl.merge(SessionImpl.java:817)
    at org.hibernate.internal.SessionImpl.merge(SessionImpl.java:821)
    at org.hibernate.ejb.AbstractEntityManagerImpl.merge(AbstractEntityManagerImpl.java:889)
    ... 32 more

The .bos file is here: https://www.dropbox.com/s/kst0fdco49zndx8/RSM-1.0.bos?dl=0

Cheers.

No answers yet.
Notifications