@ Transactional public static ServiceManagementRecord updateServiceManagementRecord ( EntityManager em , ServiceManagementRecord record ) { SystemAssert . requireArgument ( em != null , "Entity manager can not be null." ) ; SystemAssert . requireArgument ( record != null , "ServiceManagementRecord cannot be null." ) ; TypedQuery < ServiceManagementRecord > query = em . createNamedQuery ( "ServiceManagementRecord.findByService" , ServiceManagementRecord . class ) ; query . setParameter ( "service" , record . getService ( ) ) ; try { ServiceManagementRecord oldRecord = query . getSingleResult ( ) ; oldRecord . setEnabled ( record . isEnabled ( ) ) ; return em . merge ( oldRecord ) ; } catch ( NoResultException ex ) { return em . merge ( record ) ; } }
Updates the ServiceManagementRecord entity .