Hi,
I want to programatically replace existing notifications in deployment project environments with Bamboo’s Java API. Unfortunately, there is no setNotificationSet(NotificationSet) method in com.atlassian.bamboo.deployments.environments.Environment as there is in com.atlassian.bamboo.chains.Chain.
When I - instead of replacing notifications - try to first delete the existing and then add the new ones like follows
for (NotificationRule rule: environmentService.getNotificationSet(environment.id).getNotificationRules()) {
environmentService.deleteNotification(environment.id, rule);
}
for (NotificationRule rule: newNotificationRules) {
environmentService.addNotification(environment.id, rule);
}
I always get the following error:
org.springframework.orm.hibernate5.HibernateJdbcException: JDBC exception on Hibernate data access: SQLException for SQL [insert into NOTIFICATIONS (RECIPIENT_TYPE, RECIPIENT, NOTIFICATION_SET, CONDITION_KEY, CONDITION_DATA, NOTIFICATION_RULE_ID) values (?, ?, ?, ?, ?, ?)]; SQL state [null]; error code [0]; could not execute batch; nested exception is org.hibernate.exception.GenericJDBCException: could not execute batch
at org.springframework.orm.hibernate5.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:171)
at org.springframework.orm.hibernate5.HibernateTransactionManager.convertHibernateAccessException(HibernateTransactionManager.java:739)
Any ideas what I’m doing wrong?
Thanks,
Michael