Skip to content

Commit

Permalink
Setting order numbers in the api needs to be safe in a clustered
Browse files Browse the repository at this point in the history
environment - TRUNK-4183
  • Loading branch information
dkayiwa committed Jan 8, 2014
1 parent 5a228e0 commit 7ab4014
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions api/src/main/java/org/openmrs/api/impl/OrderServiceImpl.java
Expand Up @@ -32,6 +32,7 @@
import org.openmrs.api.OrderService;
import org.openmrs.api.context.Context;
import org.openmrs.api.db.OrderDAO;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;

Expand Down Expand Up @@ -218,6 +219,7 @@ public List<Order> getOrderHistoryByConcept(Patient patient, Concept concept) {
* @see org.openmrs.api.OrderService#getNextOrderNumberSeedSequenceValue()
*/
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)

This comment has been minimized.

Copy link
@wluyima

wluyima Jan 8, 2014

Member

@djazayeri what do you think of this? Having @transaction annotation on the service impl makes it fail and daniel added this as a fix

This comment has been minimized.

Copy link
@wluyima

wluyima Jan 8, 2014

Member

I have actually noticed that the test method below hangs: OrderServiceTest#getNewOrderNumber_shouldAlwaysReturnUniqueOrderNumbersWhenCalledMultipleTimesWithoutSavingOrders()

This comment has been minimized.

Copy link
@djazayeri

djazayeri via email Jan 8, 2014

Member

This comment has been minimized.

Copy link
@wluyima

wluyima Jan 8, 2014

Member

That didn't solve it

This comment has been minimized.

Copy link
@dkayiwa

dkayiwa Jan 9, 2014

Author Member

@wluyima what should i do to make it hang?

This comment has been minimized.

Copy link
@wluyima

wluyima Jan 9, 2014

Member

I'm just running the test, am doing nothing special

This comment has been minimized.

Copy link
@dkayiwa

dkayiwa Jan 9, 2014

Author Member

@wluyima does it hang when you do mvn clean install?

This comment has been minimized.

Copy link
@wluyima

wluyima Jan 9, 2014

Member

It hangs both when i do mvn clean install and running it as a junit test in the IDE

This comment has been minimized.

Copy link
@dkayiwa

dkayiwa Jan 9, 2014

Author Member

Strange because it does not happen for me locally and it does not even happen on bamboo. Do you happen to have any local changes?

public Long getNextOrderNumberSeedSequenceValue() {
return dao.getNextOrderNumberSeedSequenceValue();
}
Expand Down

0 comments on commit 7ab4014

Please sign in to comment.