Java Code Examples for javax.persistence.PersistenceException#getMessage()
The following examples show how to use
javax.persistence.PersistenceException#getMessage() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractEntityManagerFactoryBean.java From spring-analysis-note with MIT License | 5 votes |
private EntityManagerFactory buildNativeEntityManagerFactory() { EntityManagerFactory emf; try { emf = createNativeEntityManagerFactory(); } catch (PersistenceException ex) { if (ex.getClass() == PersistenceException.class) { // Plain PersistenceException wrapper for underlying exception? // Make sure the nested exception message is properly exposed, // along the lines of Spring's NestedRuntimeException.getMessage() Throwable cause = ex.getCause(); if (cause != null) { String message = ex.getMessage(); String causeString = cause.toString(); if (!message.endsWith(causeString)) { throw new PersistenceException(message + "; nested exception is " + causeString, cause); } } } throw ex; } JpaVendorAdapter jpaVendorAdapter = getJpaVendorAdapter(); if (jpaVendorAdapter != null) { jpaVendorAdapter.postProcessEntityManagerFactory(emf); } if (logger.isInfoEnabled()) { logger.info("Initialized JPA EntityManagerFactory for persistence unit '" + getPersistenceUnitName() + "'"); } return emf; }
Example 2
Source File: AbstractEntityManagerFactoryBean.java From java-technology-stack with MIT License | 5 votes |
private EntityManagerFactory buildNativeEntityManagerFactory() { EntityManagerFactory emf; try { emf = createNativeEntityManagerFactory(); } catch (PersistenceException ex) { if (ex.getClass() == PersistenceException.class) { // Plain PersistenceException wrapper for underlying exception? // Make sure the nested exception message is properly exposed, // along the lines of Spring's NestedRuntimeException.getMessage() Throwable cause = ex.getCause(); if (cause != null) { String message = ex.getMessage(); String causeString = cause.toString(); if (!message.endsWith(causeString)) { throw new PersistenceException(message + "; nested exception is " + causeString, cause); } } } throw ex; } JpaVendorAdapter jpaVendorAdapter = getJpaVendorAdapter(); if (jpaVendorAdapter != null) { jpaVendorAdapter.postProcessEntityManagerFactory(emf); } if (logger.isInfoEnabled()) { logger.info("Initialized JPA EntityManagerFactory for persistence unit '" + getPersistenceUnitName() + "'"); } return emf; }
Example 3
Source File: EntityManagerSessionImpl.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
public void flush() { if (entityManager != null && (!handleTransactions || isTransactionActive()) ) { try { entityManager.flush(); } catch (IllegalStateException ise) { throw new ActivitiException("Error while flushing EntityManager, illegal state", ise); } catch (TransactionRequiredException tre) { throw new ActivitiException("Cannot flush EntityManager, an active transaction is required", tre); } catch (PersistenceException pe) { throw new ActivitiException("Error while flushing EntityManager: " + pe.getMessage(), pe); } } }
Example 4
Source File: EntityManagerSessionImpl.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
public void flush() { if (entityManager != null && (!handleTransactions || isTransactionActive())) { try { entityManager.flush(); } catch (IllegalStateException ise) { throw new ActivitiException("Error while flushing EntityManager, illegal state", ise); } catch (TransactionRequiredException tre) { throw new ActivitiException("Cannot flush EntityManager, an active transaction is required", tre); } catch (PersistenceException pe) { throw new ActivitiException("Error while flushing EntityManager: " + pe.getMessage(), pe); } } }
Example 5
Source File: EntityManagerSessionImpl.java From flowable-engine with Apache License 2.0 | 5 votes |
@Override public void flush() { if (entityManager != null && (!handleTransactions || isTransactionActive())) { try { entityManager.flush(); } catch (IllegalStateException ise) { throw new FlowableException("Error while flushing EntityManager, illegal state", ise); } catch (TransactionRequiredException tre) { throw new FlowableException("Cannot flush EntityManager, an active transaction is required", tre); } catch (PersistenceException pe) { throw new FlowableException("Error while flushing EntityManager: " + pe.getMessage(), pe); } } }
Example 6
Source File: EntityManagerSessionImpl.java From flowable-engine with Apache License 2.0 | 5 votes |
@Override public void flush() { if (entityManager != null && (!handleTransactions || isTransactionActive())) { try { entityManager.flush(); } catch (IllegalStateException ise) { throw new ActivitiException("Error while flushing EntityManager, illegal state", ise); } catch (TransactionRequiredException tre) { throw new ActivitiException("Cannot flush EntityManager, an active transaction is required", tre); } catch (PersistenceException pe) { throw new ActivitiException("Error while flushing EntityManager: " + pe.getMessage(), pe); } } }
Example 7
Source File: EntityManagerSessionImpl.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
public void flush() { if (entityManager != null && (!handleTransactions || isTransactionActive()) ) { try { entityManager.flush(); } catch (IllegalStateException ise) { throw new ProcessEngineException("Error while flushing EntityManager, illegal state", ise); } catch (TransactionRequiredException tre) { throw new ProcessEngineException("Cannot flush EntityManager, an active transaction is required", tre); } catch (PersistenceException pe) { throw new ProcessEngineException("Error while flushing EntityManager: " + pe.getMessage(), pe); } } }
Example 8
Source File: JpaSystemException.java From lams with GNU General Public License v2.0 | 4 votes |
@Deprecated public JpaSystemException(PersistenceException ex) { super(ex.getMessage(), ex); }
Example 9
Source File: JpaSystemException.java From spring4-understanding with Apache License 2.0 | 4 votes |
public JpaSystemException(PersistenceException ex) { super(ex.getMessage(), ex); }