Buggy code:
public class PrinterServiceImpl extends BaseOpenmrsService implements PrinterService { private final Log log = LogFactory . getLog ( getClass ( ) ) ; private PrinterDAO printerDAO ; private PrinterModelDAO printerModelDAO ; private LocationService locationService ; private Map < String , PrintHandler > printHandlers = new HashMap < String , PrintHandler > ( ) ; private ConcurrentHashMap < Integer , Object > printerLocks = new ConcurrentHashMap < Integer , Object > ( ) ; public void setPrinterDAO ( PrinterDAO printerDAO ) { } public void setPrinterModelDAO ( PrinterModelDAO printerModelDAO ) { } public void setLocationService ( LocationService locationService ) { } public void setPrintHandlers ( Map < String , PrintHandler > printHandlers ) { } @ Override @ Transactional ( readOnly = true ) public Printer getPrinterById ( Integer id ) { } @ Override @ Transactional ( readOnly = true ) public Printer getPrinterByName ( String name ) { } @ Override @ Transactional ( readOnly = true ) public List < Printer > getPrintersByType ( PrinterType type ) { } @ Override @ Transactional public void savePrinter ( Printer printer ) { } @ Override @ Transactional ( readOnly = true ) public List < Printer > getAllPrinters ( ) { } @ Override @ Transactional public void deletePrinter ( Printer printer ) { } @ Override @ Transactional ( readOnly = true ) public PrinterModel getPrinterModelById ( Integer id ) { } @ Override @ Transactional ( readOnly = true ) public List < PrinterModel > getAllPrinterModels ( ) { } @ Override @ Transactional public void savePrinterModel ( PrinterModel printerModel ) { } @ Override @ Transactional ( readOnly = true ) public List < PrinterModel > getPrinterModelsByType ( PrinterType type ) { } @ Override @ Transactional public void deletePrinterModel ( PrinterModel printerModel ) { } @ Override <START_BUG> @ Transactional ( readOnly = true ) <END_BUG> public void setDefaultPrinter ( Location location , PrinterType type , Printer printer ) { LocationAttributeType locationAttributeType = getLocationAttributeTypeDefaultPrinter ( type ) ; if ( printer == null ) { for ( LocationAttribute attr : location . getActiveAttributes ( locationAttributeType ) ) { attr . setVoided ( true ) ; } } else { LocationAttribute defaultPrinter = new LocationAttribute ( ) ; defaultPrinter . setAttributeType ( locationAttributeType ) ; defaultPrinter . setValue ( printer ) ; location . setAttribute ( defaultPrinter ) ; } locationService . saveLocation ( location ) ; } @ Override @ Transactional ( readOnly = true ) public Printer getDefaultPrinter ( Location location , PrinterType type ) { } @ Override @ Transactional ( readOnly = true ) public List < Location > getLocationsWithDefaultPrinter ( PrinterType type ) { } @ Override @ Transactional ( readOnly = true ) public boolean isIpAddressAllocatedToAnotherPrinter ( Printer printer ) { } @ Override @ Transactional ( readOnly = true ) public boolean isNameAllocatedToAnotherPrinter ( Printer printer ) { } @ Override @ Transactional ( readOnly = true ) public boolean isNameAllocatedToAnotherPrinterModel ( PrinterModel printerModel ) { } @ Override public void printViaSocket ( String data , PrinterType type , Location location , String encoding ) throws UnableToPrintViaSocketException { } @ Override public void printViaSocket ( String data , PrinterType type , Location location , String encoding , Boolean printInSeparateThread , Integer wait ) throws UnableToPrintViaSocketException { } @ Override public void printViaSocket ( String data , Printer printer , String encoding ) throws UnableToPrintViaSocketException { } @ Override public void printViaSocket ( String data , Printer printer , String encoding , Boolean printInSeparateThread , Integer wait ) throws UnableToPrintViaSocketException { } @ Override public void print ( Map < String , Object > paramMap , Printer printer , Boolean printInSeparateThread ) throws UnableToPrintException { } @ Override public void print ( Map < String , Object > paramMap , Printer printer , Boolean printInSeparateThread , PrintHandler printHandler ) throws UnableToPrintException { } @ Override public Collection < PrintHandler > getRegisteredPrintHandlers ( ) { } @ Override public void registerPrintHandler ( PrintHandler printHandler ) { } @ Override public PrintHandler getRegisteredPrintHandlerByName ( String beanName ) { } @ Override public void unregisterPrintHandler ( String beanName ) { } private Object getPrinterLock ( Integer printerId ) { } private LocationAttributeType getLocationAttributeTypeDefaultPrinter ( PrinterType type ) { } private void removePrinterAsDefault ( Printer printer ) { } }

Fix:
@ Transactional