05-27-2012 04:14 PM
@Entity
public class OrderStatus extends AbstractEntity implements Serializable {
private static final long serialVersionUID = -6122412952782603911L;
@Column(unique = true, nullable = false, length = 20)
private String name;
@Column(nullable = false, length = 40)
private String description;
public String getName() { return name; }
public void setName(String name) { this.name = name; }
public String getDescription() { return description; }
public void setDescription(String description) { this.description = description; }
}
@Entity
public class Order extends AbstractEntity implements Serializable {
private static final long serialVersionUID = -8061887078955032972L;
@ManyToOne(cascade={CascadeType.REFRESH}, optional = false)
private OrderStatus status = null;
@OneToOne(cascade=CascadeType.ALL, optional = false)
private Payment payment = null;
public OrderStatus getStatus() { return status; }
public void setStatus(OrderStatus status) { this.status = status; }
public Payment getPayment() { return payment; }
public void setPayment(Payment payment) { this.payment = payment; }
}
@MappedSuperclass
public abstract class AbstractEntity implements Serializable {
private static final long serialVersionUID = 3617731729820193893L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
protected Long id;
@Version
protected int version;
@Temporal(TemporalType.TIMESTAMP)
protected Date createdOn;
@Temporal(TemporalType.TIMESTAMP)
protected Date modifiedOn;
public Long getId() { return id; }
public void setId(Long id) { this.id = id; }
public int getVersion() { return version; }
public void setVersion(int version) { this.version = version; }
public Date getCreatedOn() { return createdOn; }
public void setCreatedOn(Date createdOn) { this.createdOn = createdOn; }
public Date getModifiedOn() { return modifiedOn; }
public void setModifiedOn(Date modifiedOn) { this.modifiedOn = modifiedOn; }
@PrePersist
public void initTimeStamps() {
if (createdOn == null) {
createdOn = new Date();
}
modifiedOn = createdOn;
}
@PreUpdate
public void updateTimeStamp() { modifiedOn = new Date(); }
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((id == null) ? 0 : id.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
AbstractEntity other = (AbstractEntity) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
return true;
}
}
@Named
@Stateless
public class SetVerifyingOrderTask extends AbstractServiceTask {
private static final long serialVersionUID = 3660874744535219312L;
@EJB
OrderStatusEJB orderStatusService;
@Override
public void delegateExecute(DelegateExecution execution) throws Exception {
Order order = (Order) execution.getVariable("order");
OrderStatus orderState = orderStatusService.findByName("VERIFYING");
order.setStatus(orderState);
}
}
public abstract class AbstractServiceTask implements JavaDelegate, Serializable {
private static final long serialVersionUID = -1271784378490107598L;
protected static Logger logger = Logger.getLogger(AbstractServiceTask.class.getName());
public AbstractServiceTask() { super(); }
@Override
public void execute(DelegateExecution execution) throws Exception {
if (logger.isLoggable(Level.FINE)) {
logger.fine("execution: " + execution.getId() + "/" + execution.getProcessInstanceId());
}
// delegate to the method providing the real work…
delegateExecute(execution);
if (logger.isLoggable(Level.FINE)) {
for (String variableName : execution.getVariableNames()) {
logger.log(
Level.FINE,
"execution result: {0} = {1}",
new Object[] { variableName,
execution.getVariable(variableName) });
}
}
}
public abstract void delegateExecute(DelegateExecution execution) throws Exception;
}
<process id="verifyPayment" name="Verify Payment">
<startEvent id="startevent1" name="Start"></startEvent>
<serviceTask id="setOrderToVerifying" name="Set order state to verifying" activiti:delegateExpression="#{setVerifyingOrderTask}"></serviceTask>
<serviceTask id="checkPaymentMethod" name="Check payment method" activiti:delegateExpression="#{checkPaymentMethodTask}"></serviceTask>
<exclusiveGateway id="exclusivegateway1" name="Exclusive Gateway"></exclusiveGateway>
<userTask id="verifyPaymentData" name="Verify payment data" activiti:formKey="acceptanceOfOrder/verifyPaymentData"></userTask>
<exclusiveGateway id="exclusivegateway2" name="Exclusive Gateway"></exclusiveGateway>
<serviceTask id="setOrderToAccepted" name="Set order state to accepted" activiti:delegateExpression="#{acceptOrderTask}"></serviceTask>
<endEvent id="endevent1" name="End"></endEvent>
<sequenceFlow id="flow24" name="" sourceRef="startevent1" targetRef="setOrderToVerifying"></sequenceFlow>
<sequenceFlow id="flow25" name="" sourceRef="setOrderToVerifying" targetRef="checkPaymentMethod"></sequenceFlow>
<sequenceFlow id="flow3" name="" sourceRef="checkPaymentMethod" targetRef="exclusivegateway1"></sequenceFlow>
<sequenceFlow id="flow4" name="#{orderAlreadyPayed}" sourceRef="exclusivegateway1" targetRef="exclusivegateway2">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[#{orderAlreadyPayed}]]></conditionExpression>
</sequenceFlow>
<sequenceFlow id="flow9" name="#{!orderAlreadyPayed}" sourceRef="exclusivegateway1" targetRef="verifyPaymentData">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[#{!orderAlreadyPayed}]]></conditionExpression>
</sequenceFlow>
<sequenceFlow id="flow27" name="" sourceRef="verifyPaymentData" targetRef="exclusivegateway2"></sequenceFlow>
<sequenceFlow id="flow5" name="" sourceRef="exclusivegateway2" targetRef="setOrderToAccepted"></sequenceFlow>
<sequenceFlow id="flow26" name="" sourceRef="setOrderToAccepted" targetRef="endevent1"></sequenceFlow>
</process>
@Named
@Stateless
public class CheckNewOrdersTask extends AbstractServiceTask {
private static final long serialVersionUID = -8300047795625617499L;
@EJB
OrderEJB orderService;
@EJB
OrderStatusEJB orderStatusService;
@Override
public void delegateExecute(DelegateExecution execution) throws Exception {
OrderStatus stateNew = orderStatusService.findByName("NEW");
List<Order> orders = orderService.findByStatus(stateNew);
if (!orders.isEmpty()) {
execution.setVariable("newOrders", orders);
execution.setVariable("newOrdersAvailable", Boolean.TRUE);
} else {
execution.setVariable("newOrdersAvailable", Boolean.FALSE);
}
}
}
<process id="newOrderChecker" name="New order checker">
<startEvent id="timerstartevent1" name="Timer start">
<timerEventDefinition>
<timeCycle>R/PT2M</timeCycle>
</timerEventDefinition>
</startEvent>
<serviceTask id="checkOrderAvailable" name="Check new orders available" activiti:delegateExpression="#{checkNewOrdersTask}"></serviceTask>
<exclusiveGateway id="exclusivegateway1" name="Exclusive Gateway"></exclusiveGateway>
<endEvent id="endevent1" name="End"></endEvent>
<callActivity id="callVerifyPayment" name="Verify payment" calledElement="verifyPayment">
<extensionElements>
<activiti:in source="newOrder" target="order"></activiti:in>
</extensionElements>
<multiInstanceLoopCharacteristics isSequential="false" activiti:collection="newOrders" activiti:elementVariable="newOrder"></multiInstanceLoopCharacteristics>
</callActivity>
<exclusiveGateway id="exclusivegateway2" name="Exclusive Gateway"></exclusiveGateway>
<sequenceFlow id="flow1" name="" sourceRef="timerstartevent1" targetRef="checkOrderAvailable"></sequenceFlow>
<sequenceFlow id="flow2" name="" sourceRef="checkOrderAvailable" targetRef="exclusivegateway1"></sequenceFlow>
<sequenceFlow id="noNewOrdersFlow" name="#{!newOrdersAvailable}" sourceRef="exclusivegateway1" targetRef="exclusivegateway2">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[#{!newOrdersAvailable}]]></conditionExpression>
</sequenceFlow>
<sequenceFlow id="newOrdersFlow" name="#{newOrdersAvailable}" sourceRef="exclusivegateway1" targetRef="callVerifyPayment">
<conditionExpression xsi:type="tFormalExpression"><![CDATA[#{newOrdersAvailable}]]></conditionExpression>
</sequenceFlow>
<sequenceFlow id="flow3" name="" sourceRef="callVerifyPayment" targetRef="exclusivegateway2"></sequenceFlow>
<sequenceFlow id="flow4" name="" sourceRef="exclusivegateway2" targetRef="endevent1"></sequenceFlow>
</process>
<!– use data source from the application server –>
<jee:jndi-lookup jndi-name="jdbc/Erp" id="dataSource" />
<!– use transaction manager from the application server –>
<jee:jndi-lookup jndi-name="java:appserver/TransactionManager" id="transactionManager" />
<!– integrate Activiti with CDI and JTA –>
<bean id="processEngineConfiguration"
class="org.activiti.cdi.CdiJtaProcessEngineConfiguration">
<!– config for JTA managed persistence –>
<property name="dataSource" ref="dataSource" />
<property name="transactionManager" ref="transactionManager"/>
<property name="transactionsExternallyManaged" value="true" />
<property name="jpaPersistenceUnitName" value="erp.web" />
<property name="jpaHandleTransaction" value="false" />
<property name="jpaCloseEntityManager" value="false" />
<!– upgrade Activiti model if needed –>
<property name="databaseSchemaUpdate" value="true" />
<property name="databaseType" value="mysql" />
<!– enable timers –>
<property name="jobExecutorActivate" value="true" />
<!– log full details to the history tables –>
<property name="history" value="full" />
<!– mail server cfg for sending mails out of a mail service task –>
<property name="mailServerHost" value="localhost"/>
<property name="mailServerPort" value="25"/>
<property name="mailServerDefaultFrom" value="crm@comp.cc"/>
</bean>
FEIN: ProcessInstance[25424] executes Activity(setOrderToVerifying): org.activiti.engine.impl.bpmn.behavior.ServiceTaskDelegateExpressionActivityBehavior
SCHWERWIEGEND: No valid EE environment for injection of org.activiti.cdi.impl.context.DefaultBusinessProcessAssociationManager
AM FEINSTEN: Context interface javax.enterprise.context.ConversationScoped not active.
AM FEINSTEN: Context interface javax.enterprise.context.RequestScoped not active.
FEIN: execution: 25424/25424
FEIN: Before phase: RESTORE_VIEW 1
FEIN: After phase: RESTORE_VIEW 1
FEIN: Before phase: RENDER_RESPONSE 6
FEIN: After phase: RENDER_RESPONSE 6
AM FEINSTEN: Trying to load class with current thread context classloader: erp.model.orders.Order
AM FEINSTEN: Trying to load class with current thread context classloader: erp.model.orders.Order
FEIN: execution result: order = Order [status=OrderStatus [name=VERIFYING, description=Order verifying, toString()=AbstractEntity [id=2, version=1, createdOn=Sun May 20 21:41:31 CEST 2012, modifiedOn=Sun May 20 21:41:31 CEST 2012]], orderLines={IndirectList: not instantiated}, customer=…, payment=Payment [transactionId=0, status=SUCCESS, remoteStatus=null, method=PaymentMethod [name=INVOICE, description=per invoice, toString()=AbstractEntity [id=9, version=1, createdOn=Sun May 20 21:41:31 CEST 2012, modifiedOn=Sun May 20 21:41:31 CEST 2012]], amount=2, currencyCode=e, toString()=AbstractEntity [id=52, version=1, createdOn=Sat May 26 11:59:23 CEST 2012, modifiedOn=Sat May 26 11:59:23 CEST 2012]], toString()=AbstractEntity [id=51, version=12, createdOn=Sat May 26 11:59:23 CEST 2012, modifiedOn=Sat May 26 15:49:56 CEST 2012]]
SCHWERWIEGEND: No valid EE environment for injection of org.activiti.cdi.impl.context.DefaultBusinessProcessAssociationManager
AM FEINSTEN: Context interface javax.enterprise.context.ConversationScoped not active.
AM FEINSTEN: Context interface javax.enterprise.context.RequestScoped not active.
FEIN: Leaving activity 'setOrderToVerifying'
AM FEINSTEN: AtomicOperation: org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionNotifyListenerEnd@1d13cb2 on org.activiti.engine.impl.interceptor.CommandContext@14e4ce7
AM FEINSTEN: AtomicOperation: org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionNotifyListenerEnd@1d13cb2 on org.activiti.engine.impl.interceptor.CommandContext@14e4ce7
AM FEINSTEN: AtomicOperation: org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionDestroyScope@1e80064 on org.activiti.engine.impl.interceptor.CommandContext@14e4ce7
AM FEINSTEN: AtomicOperation: org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionNotifyListenerTake@71b9b3 on org.activiti.engine.impl.interceptor.CommandContext@14e4ce7
FEIN: ProcessInstance[25424] takes transition (setOrderToVerifying)–flow25–>(checkPaymentMethod)
AM FEINSTEN: AtomicOperation: org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionCreateScope@18ec8a3 on org.activiti.engine.impl.interceptor.CommandContext@14e4ce7
AM FEINSTEN: AtomicOperation: org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionNotifyListenerStart@1165270 on org.activiti.engine.impl.interceptor.CommandContext@14e4ce7
AM FEINSTEN: AtomicOperation: org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionNotifyListenerStart@1165270 on org.activiti.engine.impl.interceptor.CommandContext@14e4ce7
AM FEINSTEN: AtomicOperation: org.activiti.engine.impl.pvm.runtime.AtomicOperationActivityExecute@1349d88 on org.activiti.engine.impl.interceptor.CommandContext@14e4ce7
FEIN: ProcessInstance[25424] executes Activity(checkPaymentMethod): org.activiti.engine.impl.bpmn.behavior.ServiceTaskDelegateExpressionActivityBehavior
SCHWERWIEGEND: No valid EE environment for injection of org.activiti.cdi.impl.context.DefaultBusinessProcessAssociationManager
AM FEINSTEN: Context interface javax.enterprise.context.ConversationScoped not active.
AM FEINSTEN: Context interface javax.enterprise.context.RequestScoped not active.
FEIN: execution: 25424/25424
AM FEINSTEN: Trying to load class with current thread context classloader: erp.model.orders.Order
FEIN: execution result: orderAlreadyPayed = false
AM FEINSTEN: Trying to load class with current thread context classloader: erp.model.orders.Order
FEIN: execution result: order = Order [status=OrderStatus [name=VERIFYING, description=Order verifying, toString()=AbstractEntity [id=2, version=1, createdOn=Sun May 20 21:41:31 CEST 2012, modifiedOn=Sun May 20 21:41:31 CEST 2012]], orderLines={IndirectList: not instantiated}, customer=…, payment=Payment [transactionId=0, status=SUCCESS, remoteStatus=null, method=PaymentMethod [name=INVOICE, description=per invoice, toString()=AbstractEntity [id=9, version=1, createdOn=Sun May 20 21:41:31 CEST 2012, modifiedOn=Sun May 20 21:41:31 CEST 2012]], amount=2, currencyCode=e, toString()=AbstractEntity [id=52, version=1, createdOn=Sat May 26 11:59:23 CEST 2012, modifiedOn=Sat May 26 11:59:23 CEST 2012]], toString()=AbstractEntity [id=51, version=12, createdOn=Sat May 26 11:59:23 CEST 2012, modifiedOn=Sat May 26 15:49:56 CEST 2012]]
SCHWERWIEGEND: No valid EE environment for injection of org.activiti.cdi.impl.context.DefaultBusinessProcessAssociationManager
AM FEINSTEN: Context interface javax.enterprise.context.ConversationScoped not active.
AM FEINSTEN: Context interface javax.enterprise.context.RequestScoped not active.
FEIN: Leaving activity 'checkPaymentMethod'
AM FEINSTEN: AtomicOperation: org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionNotifyListenerEnd@1d13cb2 on org.activiti.engine.impl.interceptor.CommandContext@14e4ce7
AM FEINSTEN: AtomicOperation: org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionNotifyListenerEnd@1d13cb2 on org.activiti.engine.impl.interceptor.CommandContext@14e4ce7
AM FEINSTEN: AtomicOperation: org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionDestroyScope@1e80064 on org.activiti.engine.impl.interceptor.CommandContext@14e4ce7
AM FEINSTEN: AtomicOperation: org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionNotifyListenerTake@71b9b3 on org.activiti.engine.impl.interceptor.CommandContext@14e4ce7
FEIN: ProcessInstance[25424] takes transition (checkPaymentMethod)–flow3–>(exclusivegateway1)
AM FEINSTEN: AtomicOperation: org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionCreateScope@18ec8a3 on org.activiti.engine.impl.interceptor.CommandContext@14e4ce7
AM FEINSTEN: AtomicOperation: org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionNotifyListenerStart@1165270 on org.activiti.engine.impl.interceptor.CommandContext@14e4ce7
AM FEINSTEN: AtomicOperation: org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionNotifyListenerStart@1165270 on org.activiti.engine.impl.interceptor.CommandContext@14e4ce7
AM FEINSTEN: AtomicOperation: org.activiti.engine.impl.pvm.runtime.AtomicOperationActivityExecute@1349d88 on org.activiti.engine.impl.interceptor.CommandContext@14e4ce7
FEIN: ProcessInstance[25424] executes Activity(exclusivegateway1): org.activiti.engine.impl.bpmn.behavior.ExclusiveGatewayActivityBehavior
FEIN: Leaving activity 'exclusivegateway1'
SCHWERWIEGEND: No valid EE environment for injection of org.activiti.cdi.impl.context.DefaultBusinessProcessAssociationManager
AM FEINSTEN: Context interface javax.enterprise.context.ConversationScoped not active.
AM FEINSTEN: Context interface javax.enterprise.context.RequestScoped not active.
SCHWERWIEGEND: No valid EE environment for injection of org.activiti.cdi.impl.context.DefaultBusinessProcessAssociationManager
AM FEINSTEN: Context interface javax.enterprise.context.ConversationScoped not active.
AM FEINSTEN: Context interface javax.enterprise.context.RequestScoped not active.
FEIN: Sequence flow 'flow9 'selected as outgoing sequence flow.
AM FEINSTEN: AtomicOperation: org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionNotifyListenerEnd@1d13cb2 on org.activiti.engine.impl.interceptor.CommandContext@14e4ce7
AM FEINSTEN: AtomicOperation: org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionNotifyListenerEnd@1d13cb2 on org.activiti.engine.impl.interceptor.CommandContext@14e4ce7
AM FEINSTEN: AtomicOperation: org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionDestroyScope@1e80064 on org.activiti.engine.impl.interceptor.CommandContext@14e4ce7
AM FEINSTEN: AtomicOperation: org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionNotifyListenerTake@71b9b3 on org.activiti.engine.impl.interceptor.CommandContext@14e4ce7
FEIN: ProcessInstance[25424] takes transition (exclusivegateway1)–flow9–>(verifyPaymentData)
AM FEINSTEN: AtomicOperation: org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionCreateScope@18ec8a3 on org.activiti.engine.impl.interceptor.CommandContext@14e4ce7
AM FEINSTEN: AtomicOperation: org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionNotifyListenerStart@1165270 on org.activiti.engine.impl.interceptor.CommandContext@14e4ce7
AM FEINSTEN: AtomicOperation: org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionNotifyListenerStart@1165270 on org.activiti.engine.impl.interceptor.CommandContext@14e4ce7
AM FEINSTEN: AtomicOperation: org.activiti.engine.impl.pvm.runtime.AtomicOperationActivityExecute@1349d88 on org.activiti.engine.impl.interceptor.CommandContext@14e4ce7
FEIN: ProcessInstance[25424] executes Activity(verifyPaymentData): org.activiti.engine.impl.bpmn.behavior.UserTaskActivityBehavior
SCHWERWIEGEND: No valid EE environment for injection of org.activiti.cdi.impl.context.DefaultBusinessProcessAssociationManager
AM FEINSTEN: Context interface javax.enterprise.context.ConversationScoped not active.
AM FEINSTEN: Context interface javax.enterprise.context.RequestScoped not active.
WARNUNG: Local Exception Stack:
Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '2' for key 'PRIMARY'
Error Code: 1062
Call: INSERT INTO ERP_ORDERSTATUS (ID, CREATEDON, DESCRIPTION, MODIFIEDON, NAME, VERSION) VALUES (?, ?, ?, ?, ?, ?)
bind => [6 parameters bound]
Query: WriteObjectQuery(OrderStatus [name=VERIFYING, description=Order verifying, toString()=AbstractEntity [id=2, version=1, createdOn=Sun May 20 21:41:31 CEST 2012, modifiedOn=Sun May 20 21:41:31 CEST 2012]])
at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:324)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeDirectNoSelect(DatabaseAccessor.java:840)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeNoSelect(DatabaseAccessor.java:906)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:592)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:535)
at org.eclipse.persistence.internal.sessions.AbstractSession.basicExecuteCall(AbstractSession.java:1717)
at org.eclipse.persistence.sessions.server.ClientSession.executeCall(ClientSession.java:253)
at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:207)
at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:193)
at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.insertObject(DatasourceCallQueryMechanism.java:342)
at org.eclipse.persistence.internal.queries.StatementQueryMechanism.insertObject(StatementQueryMechanism.java:162)
at org.eclipse.persistence.internal.queries.StatementQueryMechanism.insertObject(StatementQueryMechanism.java:177)
at org.eclipse.persistence.internal.queries.DatabaseQueryMechanism.insertObjectForWrite(DatabaseQueryMechanism.java:472)
at org.eclipse.persistence.queries.InsertObjectQuery.executeCommit(InsertObjectQuery.java:80)
at org.eclipse.persistence.queries.InsertObjectQuery.executeCommitWithChangeSet(InsertObjectQuery.java:90)
at org.eclipse.persistence.internal.queries.DatabaseQueryMechanism.performUserDefinedWrite(DatabaseQueryMechanism.java:564)
at org.eclipse.persistence.internal.queries.DatabaseQueryMechanism.performUserDefinedInsert(DatabaseQueryMechanism.java:532)
at org.eclipse.persistence.internal.queries.DatabaseQueryMechanism.insertObjectForWrite(DatabaseQueryMechanism.java:402)
at org.eclipse.persistence.queries.WriteObjectQuery.executeCommitWithChangeSet(WriteObjectQuery.java:121)
at org.eclipse.persistence.internal.queries.DatabaseQueryMechanism.executeWriteWithChangeSet(DatabaseQueryMechanism.java:287)
at org.eclipse.persistence.queries.WriteObjectQuery.executeDatabaseQuery(WriteObjectQuery.java:58)
at org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:844)
at org.eclipse.persistence.queries.DatabaseQuery.executeInUnitOfWork(DatabaseQuery.java:743)
at org.eclipse.persistence.queries.ObjectLevelModifyQuery.executeInUnitOfWorkObjectLevelModifyQuery(ObjectLevelModifyQuery.java:108)
at org.eclipse.persistence.queries.ObjectLevelModifyQuery.executeInUnitOfWork(ObjectLevelModifyQuery.java:85)
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2871)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1516)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1498)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1449)
at org.eclipse.persistence.mappings.ObjectReferenceMapping.update(ObjectReferenceMapping.java:1156)
at org.eclipse.persistence.mappings.ObjectReferenceMapping.preUpdate(ObjectReferenceMapping.java:591)
at org.eclipse.persistence.descriptors.DescriptorQueryManager.preUpdate(DescriptorQueryManager.java:1109)
at org.eclipse.persistence.internal.queries.DatabaseQueryMechanism.updateObjectForWriteWithChangeSet(DatabaseQueryMechanism.java:1004)
at org.eclipse.persistence.queries.UpdateObjectQuery.executeCommitWithChangeSet(UpdateObjectQuery.java:84)
at org.eclipse.persistence.internal.queries.DatabaseQueryMechanism.executeWriteWithChangeSet(DatabaseQueryMechanism.java:287)
at org.eclipse.persistence.queries.WriteObjectQuery.executeDatabaseQuery(WriteObjectQuery.java:58)
at org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:844)
at org.eclipse.persistence.queries.DatabaseQuery.executeInUnitOfWork(DatabaseQuery.java:743)
at org.eclipse.persistence.queries.ObjectLevelModifyQuery.executeInUnitOfWorkObjectLevelModifyQuery(ObjectLevelModifyQuery.java:108)
at org.eclipse.persistence.queries.ObjectLevelModifyQuery.executeInUnitOfWork(ObjectLevelModifyQuery.java:85)
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2871)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1516)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1498)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1449)
at org.eclipse.persistence.internal.sessions.CommitManager.commitChangedObjectsForClassWithChangeSet(CommitManager.java:265)
at org.eclipse.persistence.internal.sessions.CommitManager.commitAllObjectsWithChangeSet(CommitManager.java:128)
at org.eclipse.persistence.internal.sessions.AbstractSession.writeAllObjectsWithChangeSet(AbstractSession.java:3799)
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.commitToDatabase(UnitOfWorkImpl.java:1415)
at org.eclipse.persistence.internal.sessions.RepeatableWriteUnitOfWork.commitToDatabase(RepeatableWriteUnitOfWork.java:636)
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.commitToDatabaseWithPreBuiltChangeSet(UnitOfWorkImpl.java:1561)
at org.eclipse.persistence.internal.sessions.RepeatableWriteUnitOfWork.writeChanges(RepeatableWriteUnitOfWork.java:447)
at org.eclipse.persistence.internal.jpa.EntityManagerImpl.flush(EntityManagerImpl.java:780)
at org.activiti.engine.impl.variable.EntityManagerSessionImpl.flush(EntityManagerSessionImpl.java:54)
at org.activiti.engine.impl.interceptor.CommandContext.flushSessions(CommandContext.java:149)
at org.activiti.engine.impl.interceptor.CommandContext.close(CommandContext.java:105)
at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:49)
at org.activiti.engine.impl.interceptor.JtaTransactionInterceptor.execute(JtaTransactionInterceptor.java:59)
at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33)
at org.activiti.engine.impl.jobexecutor.ExecuteJobsRunnable.run(ExecuteJobsRunnable.java:46)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '2' for key 'PRIMARY'
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
at com.mysql.jdbc.Util.getInstance(Util.java:386)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1039)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3597)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3529)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1990)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2151)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2625)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2119)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2415)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2333)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2318)
at com.mysql.jdbc.jdbc2.optional.PreparedStatementWrapper.executeUpdate(PreparedStatementWrapper.java:875)
at com.sun.gjc.spi.base.PreparedStatementWrapper.executeUpdate(PreparedStatementWrapper.java:125)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeDirectNoSelect(DatabaseAccessor.java:831)
… 60 more
SCHWERWIEGEND: Error while closing command context
org.activiti.engine.ActivitiException: Error while flushing EntityManager: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '2' for key 'PRIMARY'
Error Code: 1062
Call: INSERT INTO ERP_ORDERSTATUS (ID, CREATEDON, DESCRIPTION, MODIFIEDON, NAME, VERSION) VALUES (?, ?, ?, ?, ?, ?)
bind => [6 parameters bound]
Query: WriteObjectQuery(OrderStatus [name=VERIFYING, description=Order verifying, toString()=AbstractEntity [id=2, version=1, createdOn=Sun May 20 21:41:31 CEST 2012, modifiedOn=Sun May 20 21:41:31 CEST 2012]])
at org.activiti.engine.impl.variable.EntityManagerSessionImpl.flush(EntityManagerSessionImpl.java:60)
at org.activiti.engine.impl.interceptor.CommandContext.flushSessions(CommandContext.java:149)
at org.activiti.engine.impl.interceptor.CommandContext.close(CommandContext.java:105)
at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:49)
at org.activiti.engine.impl.interceptor.JtaTransactionInterceptor.execute(JtaTransactionInterceptor.java:59)
at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33)
at org.activiti.engine.impl.jobexecutor.ExecuteJobsRunnable.run(ExecuteJobsRunnable.java:46)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Caused by: javax.persistence.PersistenceException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '2' for key 'PRIMARY'
Error Code: 1062
Call: INSERT INTO ERP_ORDERSTATUS (ID, CREATEDON, DESCRIPTION, MODIFIEDON, NAME, VERSION) VALUES (?, ?, ?, ?, ?, ?)
bind => [6 parameters bound]
Query: WriteObjectQuery(OrderStatus [name=VERIFYING, description=Order verifying, toString()=AbstractEntity [id=2, version=1, createdOn=Sun May 20 21:41:31 CEST 2012, modifiedOn=Sun May 20 21:41:31 CEST 2012]])
at org.eclipse.persistence.internal.jpa.EntityManagerImpl.flush(EntityManagerImpl.java:786)
at org.activiti.engine.impl.variable.EntityManagerSessionImpl.flush(EntityManagerSessionImpl.java:54)
… 9 more
Caused by: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '2' for key 'PRIMARY'
Error Code: 1062
Call: INSERT INTO ERP_ORDERSTATUS (ID, CREATEDON, DESCRIPTION, MODIFIEDON, NAME, VERSION) VALUES (?, ?, ?, ?, ?, ?)
bind => [6 parameters bound]
Query: WriteObjectQuery(OrderStatus [name=VERIFYING, description=Order verifying, toString()=AbstractEntity [id=2, version=1, createdOn=Sun May 20 21:41:31 CEST 2012, modifiedOn=Sun May 20 21:41:31 CEST 2012]])
at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:324)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeDirectNoSelect(DatabaseAccessor.java:840)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeNoSelect(DatabaseAccessor.java:906)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:592)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:535)
at org.eclipse.persistence.internal.sessions.AbstractSession.basicExecuteCall(AbstractSession.java:1717)
at org.eclipse.persistence.sessions.server.ClientSession.executeCall(ClientSession.java:253)
at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:207)
at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:193)
at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.insertObject(DatasourceCallQueryMechanism.java:342)
at org.eclipse.persistence.internal.queries.StatementQueryMechanism.insertObject(StatementQueryMechanism.java:162)
at org.eclipse.persistence.internal.queries.StatementQueryMechanism.insertObject(StatementQueryMechanism.java:177)
at org.eclipse.persistence.internal.queries.DatabaseQueryMechanism.insertObjectForWrite(DatabaseQueryMechanism.java:472)
at org.eclipse.persistence.queries.InsertObjectQuery.executeCommit(InsertObjectQuery.java:80)
at org.eclipse.persistence.queries.InsertObjectQuery.executeCommitWithChangeSet(InsertObjectQuery.java:90)
at org.eclipse.persistence.internal.queries.DatabaseQueryMechanism.performUserDefinedWrite(DatabaseQueryMechanism.java:564)
at org.eclipse.persistence.internal.queries.DatabaseQueryMechanism.performUserDefinedInsert(DatabaseQueryMechanism.java:532)
at org.eclipse.persistence.internal.queries.DatabaseQueryMechanism.insertObjectForWrite(DatabaseQueryMechanism.java:402)
at org.eclipse.persistence.queries.WriteObjectQuery.executeCommitWithChangeSet(WriteObjectQuery.java:121)
at org.eclipse.persistence.internal.queries.DatabaseQueryMechanism.executeWriteWithChangeSet(DatabaseQueryMechanism.java:287)
at org.eclipse.persistence.queries.WriteObjectQuery.executeDatabaseQuery(WriteObjectQuery.java:58)
at org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:844)
at org.eclipse.persistence.queries.DatabaseQuery.executeInUnitOfWork(DatabaseQuery.java:743)
at org.eclipse.persistence.queries.ObjectLevelModifyQuery.executeInUnitOfWorkObjectLevelModifyQuery(ObjectLevelModifyQuery.java:108)
at org.eclipse.persistence.queries.ObjectLevelModifyQuery.executeInUnitOfWork(ObjectLevelModifyQuery.java:85)
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2871)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1516)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1498)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1449)
at org.eclipse.persistence.mappings.ObjectReferenceMapping.update(ObjectReferenceMapping.java:1156)
at org.eclipse.persistence.mappings.ObjectReferenceMapping.preUpdate(ObjectReferenceMapping.java:591)
at org.eclipse.persistence.descriptors.DescriptorQueryManager.preUpdate(DescriptorQueryManager.java:1109)
at org.eclipse.persistence.internal.queries.DatabaseQueryMechanism.updateObjectForWriteWithChangeSet(DatabaseQueryMechanism.java:1004)
at org.eclipse.persistence.queries.UpdateObjectQuery.executeCommitWithChangeSet(UpdateObjectQuery.java:84)
at org.eclipse.persistence.internal.queries.DatabaseQueryMechanism.executeWriteWithChangeSet(DatabaseQueryMechanism.java:287)
at org.eclipse.persistence.queries.WriteObjectQuery.executeDatabaseQuery(WriteObjectQuery.java:58)
at org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:844)
at org.eclipse.persistence.queries.DatabaseQuery.executeInUnitOfWork(DatabaseQuery.java:743)
at org.eclipse.persistence.queries.ObjectLevelModifyQuery.executeInUnitOfWorkObjectLevelModifyQuery(ObjectLevelModifyQuery.java:108)
at org.eclipse.persistence.queries.ObjectLevelModifyQuery.executeInUnitOfWork(ObjectLevelModifyQuery.java:85)
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2871)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1516)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1498)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1449)
at org.eclipse.persistence.internal.sessions.CommitManager.commitChangedObjectsForClassWithChangeSet(CommitManager.java:265)
at org.eclipse.persistence.internal.sessions.CommitManager.commitAllObjectsWithChangeSet(CommitManager.java:128)
at org.eclipse.persistence.internal.sessions.AbstractSession.writeAllObjectsWithChangeSet(AbstractSession.java:3799)
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.commitToDatabase(UnitOfWorkImpl.java:1415)
at org.eclipse.persistence.internal.sessions.RepeatableWriteUnitOfWork.commitToDatabase(RepeatableWriteUnitOfWork.java:636)
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.commitToDatabaseWithPreBuiltChangeSet(UnitOfWorkImpl.java:1561)
at org.eclipse.persistence.internal.sessions.RepeatableWriteUnitOfWork.writeChanges(RepeatableWriteUnitOfWork.java:447)
at org.eclipse.persistence.internal.jpa.EntityManagerImpl.flush(EntityManagerImpl.java:780)
… 10 more
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '2' for key 'PRIMARY'
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
at com.mysql.jdbc.Util.getInstance(Util.java:386)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1039)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3597)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3529)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1990)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2151)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2625)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2119)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2415)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2333)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2318)
at com.mysql.jdbc.jdbc2.optional.PreparedStatementWrapper.executeUpdate(PreparedStatementWrapper.java:875)
at com.sun.gjc.spi.base.PreparedStatementWrapper.executeUpdate(PreparedStatementWrapper.java:125)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeDirectNoSelect(DatabaseAccessor.java:831)
… 60 more
FEIN: firing event rolling back…
FEIN: rolling back ibatis sql session…
FEIN: firing event rolled back…
FEIN: — ExecuteJobsCmd finished ——————————————————–
SCHWERWIEGEND: Exception in thread "pool-16-thread-1"
SCHWERWIEGEND: org.activiti.engine.ActivitiException: Error while flushing EntityManager: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '2' for key 'PRIMARY'
Error Code: 1062
Call: INSERT INTO ERP_ORDERSTATUS (ID, CREATEDON, DESCRIPTION, MODIFIEDON, NAME, VERSION) VALUES (?, ?, ?, ?, ?, ?)
bind => [6 parameters bound]
Query: WriteObjectQuery(OrderStatus [name=VERIFYING, description=Order verifying, toString()=AbstractEntity [id=2, version=1, createdOn=Sun May 20 21:41:31 CEST 2012, modifiedOn=Sun May 20 21:41:31 CEST 2012]])
at org.activiti.engine.impl.variable.EntityManagerSessionImpl.flush(EntityManagerSessionImpl.java:60)
at org.activiti.engine.impl.interceptor.CommandContext.flushSessions(CommandContext.java:149)
at org.activiti.engine.impl.interceptor.CommandContext.close(CommandContext.java:105)
at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:49)
at org.activiti.engine.impl.interceptor.JtaTransactionInterceptor.execute(JtaTransactionInterceptor.java:59)
at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33)
at org.activiti.engine.impl.jobexecutor.ExecuteJobsRunnable.run(ExecuteJobsRunnable.java:46)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Caused by: javax.persistence.PersistenceException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '2' for key 'PRIMARY'
Error Code: 1062
Call: INSERT INTO ERP_ORDERSTATUS (ID, CREATEDON, DESCRIPTION, MODIFIEDON, NAME, VERSION) VALUES (?, ?, ?, ?, ?, ?)
bind => [6 parameters bound]
Query: WriteObjectQuery(OrderStatus [name=VERIFYING, description=Order verifying, toString()=AbstractEntity [id=2, version=1, createdOn=Sun May 20 21:41:31 CEST 2012, modifiedOn=Sun May 20 21:41:31 CEST 2012]])
at org.eclipse.persistence.internal.jpa.EntityManagerImpl.flush(EntityManagerImpl.java:786)
at org.activiti.engine.impl.variable.EntityManagerSessionImpl.flush(EntityManagerSessionImpl.java:54)
… 9 more
Caused by: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '2' for key 'PRIMARY'
Error Code: 1062
Call: INSERT INTO ERP_ORDERSTATUS (ID, CREATEDON, DESCRIPTION, MODIFIEDON, NAME, VERSION) VALUES (?, ?, ?, ?, ?, ?)
bind => [6 parameters bound]
Query: WriteObjectQuery(OrderStatus [name=VERIFYING, description=Order verifying, toString()=AbstractEntity [id=2, version=1, createdOn=Sun May 20 21:41:31 CEST 2012, modifiedOn=Sun May 20 21:41:31 CEST 2012]])
at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:324)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeDirectNoSelect(DatabaseAccessor.java:840)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeNoSelect(DatabaseAccessor.java:906)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:592)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:535)
at org.eclipse.persistence.internal.sessions.AbstractSession.basicExecuteCall(AbstractSession.java:1717)
at org.eclipse.persistence.sessions.server.ClientSession.executeCall(ClientSession.java:253)
at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:207)
at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:193)
at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.insertObject(DatasourceCallQueryMechanism.java:342)
at org.eclipse.persistence.internal.queries.StatementQueryMechanism.insertObject(StatementQueryMechanism.java:162)
at org.eclipse.persistence.internal.queries.StatementQueryMechanism.insertObject(StatementQueryMechanism.java:177)
at org.eclipse.persistence.internal.queries.DatabaseQueryMechanism.insertObjectForWrite(DatabaseQueryMechanism.java:472)
at org.eclipse.persistence.queries.InsertObjectQuery.executeCommit(InsertObjectQuery.java:80)
at org.eclipse.persistence.queries.InsertObjectQuery.executeCommitWithChangeSet(InsertObjectQuery.java:90)
at org.eclipse.persistence.internal.queries.DatabaseQueryMechanism.performUserDefinedWrite(DatabaseQueryMechanism.java:564)
at org.eclipse.persistence.internal.queries.DatabaseQueryMechanism.performUserDefinedInsert(DatabaseQueryMechanism.java:532)
at org.eclipse.persistence.internal.queries.DatabaseQueryMechanism.insertObjectForWrite(DatabaseQueryMechanism.java:402)
at org.eclipse.persistence.queries.WriteObjectQuery.executeCommitWithChangeSet(WriteObjectQuery.java:121)
at org.eclipse.persistence.internal.queries.DatabaseQueryMechanism.executeWriteWithChangeSet(DatabaseQueryMechanism.java:287)
at org.eclipse.persistence.queries.WriteObjectQuery.executeDatabaseQuery(WriteObjectQuery.java:58)
at org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:844)
at org.eclipse.persistence.queries.DatabaseQuery.executeInUnitOfWork(DatabaseQuery.java:743)
at org.eclipse.persistence.queries.ObjectLevelModifyQuery.executeInUnitOfWorkObjectLevelModifyQuery(ObjectLevelModifyQuery.java:108)
at org.eclipse.persistence.queries.ObjectLevelModifyQuery.executeInUnitOfWork(ObjectLevelModifyQuery.java:85)
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2871)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1516)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1498)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1449)
at org.eclipse.persistence.mappings.ObjectReferenceMapping.update(ObjectReferenceMapping.java:1156)
at org.eclipse.persistence.mappings.ObjectReferenceMapping.preUpdate(ObjectReferenceMapping.java:591)
at org.eclipse.persistence.descriptors.DescriptorQueryManager.preUpdate(DescriptorQueryManager.java:1109)
at org.eclipse.persistence.internal.queries.DatabaseQueryMechanism.updateObjectForWriteWithChangeSet(DatabaseQueryMechanism.java:1004)
at org.eclipse.persistence.queries.UpdateObjectQuery.executeCommitWithChangeSet(UpdateObjectQuery.java:84)
at org.eclipse.persistence.internal.queries.DatabaseQueryMechanism.executeWriteWithChangeSet(DatabaseQueryMechanism.java:287)
at org.eclipse.persistence.queries.WriteObjectQuery.executeDatabaseQuery(WriteObjectQuery.java:58)
at org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:844)
at org.eclipse.persistence.queries.DatabaseQuery.executeInUnitOfWork(DatabaseQuery.java:743)
at org.eclipse.persistence.queries.ObjectLevelModifyQuery.executeInUnitOfWorkObjectLevelModifyQuery(ObjectLevelModifyQuery.java:108)
at org.eclipse.persistence.queries.ObjectLevelModifyQuery.executeInUnitOfWork(ObjectLevelModifyQuery.java:85)
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2871)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1516)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1498)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1449)
at org.eclipse.persistence.internal.sessions.CommitManager.commitChangedObjectsForClassWithChangeSet(CommitManager.java:265)
at org.eclipse.persistence.internal.sessions.CommitManager.commitAllObjectsWithChangeSet(CommitManager.java:128)
at org.eclipse.persistence.internal.sessions.AbstractSession.writeAllObjectsWithChangeSet(AbstractSession.java:3799)
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.commitToDatabase(UnitOfWorkImpl.java:1415)
at org.eclipse.persistence.internal.sessions.RepeatableWriteUnitOfWork.commitToDatabase(RepeatableWriteUnitOfWork.java:636)
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.commitToDatabaseWithPreBuiltChangeSet(UnitOfWorkImpl.java:1561)
at org.eclipse.persistence.internal.sessions.RepeatableWriteUnitOfWork.writeChanges(RepeatableWriteUnitOfWork.java:447)
at org.eclipse.persistence.internal.jpa.EntityManagerImpl.flush(EntityManagerImpl.java:780)
… 10 more
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '2' for key 'PRIMARY'
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
at com.mysql.jdbc.Util.getInstance(Util.java:386)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1039)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3597)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3529)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1990)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2151)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2625)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2119)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2415)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2333)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2318)
at com.mysql.jdbc.jdbc2.optional.PreparedStatementWrapper.executeUpdate(PreparedStatementWrapper.java:875)
at com.sun.gjc.spi.base.PreparedStatementWrapper.executeUpdate(PreparedStatementWrapper.java:125)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeDirectNoSelect(DatabaseAccessor.java:831)
… 60 more
05-29-2012 08:14 AM
06-03-2012 02:56 PM
<jee:jndi-lookup id="entityManagerFactory" jndi-name="java:comp/env/persistence/erpEMF" lookup-on-startup="false" proxy-interface="javax.persistence.EntityManagerFactory"/>
…
<bean id="processEngineConfiguration"
class="org.activiti.cdi.CdiJtaProcessEngineConfiguration">
<property name="jpaEntityManagerFactory" ref="entityManagerFactory" />
…
does not work from the Spring based Activiti initialisation.
<bean id="entityManagerFactory" class="erp.domain.activiti.mgnt.EMFProxy">
<property name="jndiName" value="java:comp/env/persistence/erpEMF" />
</bean>
…
<bean id="processEngineConfiguration"
class="org.activiti.cdi.CdiJtaProcessEngineConfiguration">
<property name="jpaEntityManagerFactory" ref="entityManagerFactory" />
…
FEIN: Start with context: 'java:comp/env'
SCHWERWIEGEND: Error dumping JNDI tree
javax.naming.NamingException: Lookup failed for 'java:comp/env' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming} [Root exception is javax.naming.NamingException: Invocation exception: Got null ComponentInvocation ]
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:518)
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:455)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at erp.domain.activiti.mgnt.JNDITreeDumper.dumpJndiTree(JNDITreeDumper.java:33)
at erp.domain.activiti.mgnt.EMFProxy.initialiseEMF(EMFProxy.java:104)
at erp.domain.activiti.mgnt.EMFProxy.createEntityManager(EMFProxy.java:44)
at org.activiti.engine.impl.variable.EntityManagerSessionImpl.getEntityManager(EntityManagerSessionImpl.java:84)
at org.activiti.engine.impl.variable.JPAEntityMappings.findEntity(JPAEntityMappings.java:123)
at org.activiti.engine.impl.variable.JPAEntityMappings.getJPAEntity(JPAEntityMappings.java:119)
at org.activiti.engine.impl.variable.JPAEntityVariableType.getValue(JPAEntityVariableType.java:77)
at org.activiti.engine.impl.persistence.entity.VariableInstanceEntity.getValue(VariableInstanceEntity.java:158)
at org.activiti.engine.impl.persistence.entity.VariableScopeImpl.getVariable(VariableScopeImpl.java:93)
at org.activiti.engine.impl.bpmn.behavior.CallActivityBehavior.execute(CallActivityBehavior.java:79)
06-09-2012 05:24 AM
02-08-2013 08:05 AM
02-10-2013 07:22 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.