Appian Community
Site
Search
Sign In/Register
Site
Search
User
DISCUSS
LEARN
SUCCESS
SUPPORT
Documentation
AppMarket
More
Cancel
I'm looking for ...
State
Not Answered
Replies
4 replies
Subscribers
6 subscribers
Views
5980 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
Process
I am trying to update a database table through write to data store entity smart
Ketan Patel
Certified Lead Developer
over 9 years ago
I am trying to update a database table through write to data store entity smart service. The CDT has an ID column which is defined as follows:
<xsd:element form="qualified" name="routingRuleWorkflowId"
nillable="true" type="xsd:int">
<xsd:annotation>
<xsd:appinfo source="appian.jpa">
@Id
@GeneratedValue
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
When the table is created with the above xsd definition (along with some additional columns) – a Primary Key constraint is also created automatically in DB for this column with name: C0079862.
When I am trying to write above CDT to table – I am getting following error:
Details: org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update: java.sql.BatchUpdateException: ORA-00001: unique constraint (BPMBUSINESS.SYS_C0079862) violated
[Appian Work Item - 30984 - ProcessExec01 : UnattendedJavaActivityRequest] ERROR com.appiancor...
OriginalPostID-167906
OriginalPostID-167906
Discussion posts and replies are publicly visible
0
Ketan Patel
Certified Lead Developer
over 9 years ago
...p.process.engine.UnattendedJavaActivityRequest - An error occurred while executing activity: id=269041297, classname=com.appiancorp.process.runtime.activities.WriteToDataStoreSmartService
(Appian Work Item - 30984 - ProcessExec01 : UnattendedJavaActivityRequest) com.appiancorp.suiteapi.process.exceptions.SmartServiceException: userMsg[error.duringWrite.userMsg=An error occurred while trying to write to the entity “RoutingRuleWorkflows” [id=e441eea9-cc6c-459a-ad31-0d8179728dd7@87483, type=XXX_RoutingRuleWorkflows (id=4222)] (data store: XXXDatastore). Details: org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update: java.sql.BatchUpdateException: ORA-00001: unique constraint (BPMBUSINESS.SYS_C0079862) violated
(Appian Work Item - 30984 - ProcessExec01 : UnattendedJavaActivityRequest) Data: TypedValue[it=4223,v={{2,2,1,0,1,1,1,1,0,Ketan,<null>,ketan,2015-09-17 20:27:16.53,1,1,1},{<null>,2,1,0,1,0,1,0,1,ketan,2015-09-17 20:27:16.53,9/...
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Ketan Patel
Certified Lead Developer
over 9 years ago
...17/2015 8:27 PM GMT+00:00,2015-09-17 20:27:16.53,2,0,1}}]] alertMsg[error.duringWrite.alertMsg=An error occurred while trying to write to the entity “RoutingRuleWorkflows” [id=e441eea9-cc6c-459a-ad31-0d8179728dd7@87483, type=RoutingRuleWorkflows (id=4222)] (data store: XXXMDatastore). Details: org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update: java.sql.BatchUpdateException: ORA-00001: unique constraint (SYS_C0079862) violated
(Appian Work Item - 30984 - ProcessExec01 : UnattendedJavaActivityRequest) Data: TypedValue[it=4223,v={{2,2,1,0,1,1,1,1,0,Ketan,<null>,ketan,2015-09-17 20:27:16.53,1,1,1},{<null>,2,1,0,1,0,1,0,1,ketan,2015-09-17 20:27:16.53,9/17/2015 8:27 PM GMT+00:00,2015-09-17 20:27:16.53,2,0,1}}]]
(Appian Work Item - 30984 - ProcessExec01 : UnattendedJavaActivityRequest) at com.appiancorp.suiteapi.process.exceptions.SmartServiceException$Builder.build(SmartServiceException.java:127)
The CDT has two records:
Record1...
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Ketan Patel
Certified Lead Developer
over 9 years ago
... : 2 (Primary Key),2,1,0,1,1,1,1,0,Ketan,<null>,ketan,2015-09-17 20:27:16.53,1,1,1
Record2: <null>(Primary Key),2,1,0,1,0,1,0,1,ketan,2015-09-17 20:27:16.53,9/17/2015 8:27 PM GMT+00:00,2015-09-17 20:27:16.53,2,0,1
Record 1 has some updated value and Record 2 is a new insert and hence Primary Key is passed as NULL since it is @GeneratedValue.
The issue what I understand is Hibernate is throwing unique constraint violation exception for a row which I am trying to Update or in other words Hibernate is trying to Insert a record which I am trying to Update.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
mahipalc
over 9 years ago
As per my understanding there is no prob with record -2.
I think on record -1 : it looks like it is trying to do an insert instead of an update operation.
This will happen if you are manually populating the primary key field in the process instead of passing the entire PV.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel