本文整理汇总了Java中javax.persistence.PersistenceException.getLocalizedMessage方法的典型用法代码示例。如果您正苦于以下问题:Java PersistenceException.getLocalizedMessage方法的具体用法?Java PersistenceException.getLocalizedMessage怎么用?Java PersistenceException.getLocalizedMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.persistence.PersistenceException
的用法示例。
在下文中一共展示了PersistenceException.getLocalizedMessage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: update
import javax.persistence.PersistenceException; //导入方法依赖的package包/类
@Override
@Transactional
public Module update(Module module) throws ServiceException {
logger.debug("update : Methods parameters : " + module.toString());
logger.info("ModuleService : Starting updating Module " + module.getName());
try {
module = moduleDAO.save(module);
} catch (PersistenceException e) {
module.setStatus(Status.FAIL);
module = moduleDAO.save(module);
logger.error("ModuleService Error : update Module" + e);
throw new ServiceException(e.getLocalizedMessage(), e);
}
logger.info("ModuleService : Module " + module.getName() + " successfully updated.");
return module;
}
示例2: activationAccount
import javax.persistence.PersistenceException; //导入方法依赖的package包/类
@Override
@Transactional
public void activationAccount(User user)
throws ServiceException {
try {
logger.debug("UserService : User " + user.toString());
user = userDAO.findOne(user.getId());
user.setStatus(User.STATUS_ACTIF);
user = userDAO.saveAndFlush(user);
} catch (PersistenceException e) {
logger.error("UserService Error : Activate User Account" + e);
throw new ServiceException(e.getLocalizedMessage(), e);
}
logger.info("UserService : User " + user.getLastName()
+ " account activated - status = " + user.getStatus());
}
示例3: update
import javax.persistence.PersistenceException; //导入方法依赖的package包/类
@Override
@Transactional
public User update(User user)
throws ServiceException {
logger.debug("update : Methods parameters : " + user.toString());
logger.info("UserService : Starting updating user "
+ user.getLastName());
try {
userDAO.saveAndFlush(user);
} catch (PersistenceException e) {
logger.error("UserService Error : update User" + e);
throw new ServiceException(e.getLocalizedMessage(), e);
}
logger.info("UserService : User " + user.getLogin()
+ " successfully updated.");
return user;
}
示例4: startModule
import javax.persistence.PersistenceException; //导入方法依赖的package包/类
@Override
@Transactional
public Module startModule(String moduleName) throws ServiceException {
logger.info("Module : Starting module " + moduleName);
Module module = null;
try {
module = findByName(moduleName);
module = dockerService.startModule(moduleName, module);
applicationEventPublisher.publishEvent(new ModuleStartEvent(module));
if (!module.isInitialized()) {
module.setInitialized(true);
module = moduleDAO.save(module);
applicationEventPublisher
.publishEvent(new HookEvent(new Hook(moduleName, RemoteExecAction.MODULE_POST_START_ONCE)));
}
applicationEventPublisher
.publishEvent(new HookEvent(new Hook(moduleName, RemoteExecAction.MODULE_POST_START)));
} catch (PersistenceException e) {
logger.error("ModuleService Error : fail to start Module" + moduleName);
throw new ServiceException(e.getLocalizedMessage(), e);
}
return module;
}
示例5: update
import javax.persistence.PersistenceException; //导入方法依赖的package包/类
@Override
@Transactional
public Image update(Image image)
throws ServiceException {
logger.debug("update : Methods parameters : " + image.toString());
logger.info("ImageService : Starting updating image " + image.getName());
try {
imageDAO.saveAndFlush(image);
} catch (PersistenceException e) {
logger.error("ImageService Error : update Image" + e);
throw new ServiceException(e.getLocalizedMessage(), e);
}
logger.info("ImageService : Image " + image.getName()
+ "successfully updated.");
return image;
}
示例6: changePassword
import javax.persistence.PersistenceException; //导入方法依赖的package包/类
@Transactional
@Override
public void changePassword(User user, String newPassword)
throws ServiceException {
Map<String, String> configShell = new HashMap<>();
String userLogin = user.getLogin();
user = this.findById(user.getId());
user.setPassword(newPassword);
List<Application> listApplications = user.getApplications();
try {
logger.debug("Methods parameters : " + user + " new password : "
+ newPassword);
userDAO.saveAndFlush(user);
} catch (PersistenceException e) {
logger.error("Error UserService : error changePassword : " + e);
throw new ServiceException(e.getLocalizedMessage(), e);
}
logger.info("UserService : User " + user.getLastName()
+ " password successfully updated.");
}
示例7: create
import javax.persistence.PersistenceException; //导入方法依赖的package包/类
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public Message create(Message message)
throws ServiceException {
try {
message.setCuInstanceName(cuInstanceName);
return messageDAO.save(message);
} catch (PersistenceException e) {
throw new ServiceException(e.getLocalizedMessage(), e);
}
}
示例8: delete
import javax.persistence.PersistenceException; //导入方法依赖的package包/类
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void delete(Message message)
throws ServiceException {
try {
messageDAO.delete(message);
} catch (PersistenceException e) {
throw new ServiceException(e.getLocalizedMessage(), e);
}
}
示例9: findById
import javax.persistence.PersistenceException; //导入方法依赖的package包/类
@Override
public Image findById(Integer id)
throws ServiceException {
try {
logger.debug("findById : Methods parameters : " + id);
Image image = imageDAO.findOne(id);
logger.info("image with id " + id + " found!");
return image;
} catch (PersistenceException e) {
logger.error("Error ImageService : error findById Method : " + e);
throw new ServiceException(e.getLocalizedMessage(), e);
}
}
示例10: listByApp
import javax.persistence.PersistenceException; //导入方法依赖的package包/类
@Override
public List<Message> listByApp(User user, String applicationName,
int nbMessages)
throws ServiceException {
try {
Pageable pageable = new PageRequest(0, nbMessages,
sortByLastNameAsc());
Page<Message> requestedPage = messageDAO.listByApp(user,
applicationName, cuInstanceName, pageable);
return requestedPage.getContent();
} catch (PersistenceException e) {
throw new ServiceException(e.getLocalizedMessage(), e);
}
}
示例11: findById
import javax.persistence.PersistenceException; //导入方法依赖的package包/类
@Override
public Module findById(Integer id) throws ServiceException {
try {
logger.debug("findById : Methods parameters : " + id);
Module module = moduleDAO.findOne(id);
logger.info("Module with id " + id + " found!");
return module;
} catch (PersistenceException e) {
logger.error("Error ModuleService : error findById Method : " + e);
throw new ServiceException(e.getLocalizedMessage(), e);
}
}
示例12: findAll
import javax.persistence.PersistenceException; //导入方法依赖的package包/类
@Override
public List<Server> findAll() throws ServiceException {
try {
logger.debug("start findAll");
List<Server> servers = serverDAO.findAll();
logger.info("ServerService : All Servers found ");
return servers;
} catch (PersistenceException e) {
logger.error("Error ServerService : error findAll Method : " + e);
throw new ServiceException("Error database : " + e.getLocalizedMessage(), e);
}
}
示例13: findEnabledImages
import javax.persistence.PersistenceException; //导入方法依赖的package包/类
@Override
public List<Image> findEnabledImages()
throws ServiceException {
try {
logger.debug("start find enabled images");
List<Image> images = imageDAO.findAllEnabledImages();
logger.info("ImageService : enabled found ");
return images;
} catch (PersistenceException e) {
logger.error("Error ImageService : error find enabled images Method : "
+ e);
throw new ServiceException(e.getLocalizedMessage(), e);
}
}
示例14: findAll
import javax.persistence.PersistenceException; //导入方法依赖的package包/类
@Override
public List<Image> findAll()
throws ServiceException {
try {
logger.debug("start findAll");
List<Image> images = imageDAO.findAll();
logger.info("ImageService : All Images found ");
return images;
} catch (PersistenceException e) {
logger.error("Error ImageService : error findById Method : " + e);
throw new ServiceException(e.getLocalizedMessage(), e);
}
}
示例15: findByContainerID
import javax.persistence.PersistenceException; //导入方法依赖的package包/类
@Override
public Server findByContainerID(String id) throws ServiceException {
try {
return serverDAO.findByContainerID(id);
} catch (PersistenceException e) {
throw new ServiceException("Error database : " + e.getLocalizedMessage(), e);
}
}