Package javax.persistence

Examples of javax.persistence.PersistenceException


                    holder.result = result;
                    holder.exchange = createExchange(result);
                    answer.add(holder);
                }

                PersistenceException cause = null;
                int messagePolled = 0;
                try {
                    messagePolled = processBatch(CastUtils.cast(answer));
                } catch (Exception e) {
                    if (e instanceof PersistenceException) {
                        cause = (PersistenceException) e;
                    } else {
                        cause = new PersistenceException(e);
                    }
                }

                if (cause != null) {
                    if (!isTransacted()) {
                        LOG.warn("Error processing last message due: {}. Will commit all previous successful processed message, and ignore this last failure.", cause.getMessage(), cause);
                    } else {
                        // rollback all by throwning exception
                        throw cause;
                    }
                }
View Full Code Here


                        // into the processor
                        Exchange exchange = createExchange(result);
                        try {
                            getProcessor().process(exchange);
                        } catch (Exception e) {
                            throw new PersistenceException(e);
                        }
                        getDeleteHandler().deleteObject(entityManager, result);
                    }
                }
                entityManager.flush();
View Full Code Here

    }
    catch (PersistenceException pe) {
      throw pe;
    }
    catch (Exception e) {
      throw new PersistenceException( "Unable to build EntityManagerFactory", e );
    }
  }
View Full Code Here

    @Override
    public String convertToDatabaseColumn(final Map<String, String> contextMap) {
        try {
            return OBJECT_MAPPER.writeValueAsString(contextMap);
        } catch (IOException e) {
            throw new PersistenceException("Failed to convert map to JSON string.", e);
        }
    }
View Full Code Here

            return null;
        }
        try {
            return OBJECT_MAPPER.readValue(s, new TypeReference<Map<String, String>>() { });
        } catch (IOException e) {
            throw new PersistenceException("Failed to convert JSON string to map.", e);
        }
    }
View Full Code Here

    @Override
    public String convertToDatabaseColumn(final ThreadContext.ContextStack contextStack) {
        try {
            return ContextMapJsonAttributeConverter.OBJECT_MAPPER.writeValueAsString(contextStack.asList());
        } catch (IOException e) {
            throw new PersistenceException("Failed to convert stack list to JSON string.", e);
        }
    }
View Full Code Here

        List<String> list;
        try {
            list = ContextMapJsonAttributeConverter.OBJECT_MAPPER.readValue(s, new TypeReference<List<String>>() { });
        } catch (IOException e) {
            throw new PersistenceException("Failed to convert JSON string to list for stack.", e);
        }

        DefaultThreadContextStack result = new DefaultThreadContextStack(true);
        result.addAll(list);
        return result;
View Full Code Here

                        {
                            return createProxy(clazz);
                        }
                        else
                        {
                            throw new PersistenceException("Unable to unwrap for " + clazz);
                        }
                    }
                    return null;
                }
            })
View Full Code Here

            Class clazz = classLoader.loadClass(persistenceProviderClassName);
            PersistenceProvider persistenceProvider = (PersistenceProvider) clazz.newInstance();
            entityManagerFactory = persistenceProvider.createContainerEntityManagerFactory(persistenceUnitInfo, properties);
        } catch (ClassNotFoundException e) {
            persistenceUnitInfo.destroy();
            throw new PersistenceException("Could not locate PersistenceProvider class: " + persistenceProviderClassName + " in classloader " + classLoader, e);
        } catch (InstantiationException e) {
            persistenceUnitInfo.destroy();
            throw new PersistenceException("Could not create PersistenceProvider instance: " + persistenceProviderClassName + " loaded from classloader " + classLoader, e);
        } catch (IllegalAccessException e) {
            persistenceUnitInfo.destroy();
            throw new PersistenceException("Could not create PersistenceProvider instance: " + persistenceProviderClassName + " loaded from classloader " + classLoader, e);
        }
        this.transactionManager = transactionManager;
        this.entityManagerRegistry = new SingleElementCollection<ExtendedEntityManagerRegistry>(entityManagerRegistry);
    }
View Full Code Here

            Class clazz = classLoader.loadClass(persistenceProviderClassName);
            PersistenceProvider persistenceProvider = (PersistenceProvider) clazz.newInstance();
            entityManagerFactory = persistenceProvider.createContainerEntityManagerFactory(persistenceUnitInfo, properties);
        } catch (ClassNotFoundException e) {
            persistenceUnitInfo.destroy();
            throw new PersistenceException("Could not locate PersistenceProvider class: " + persistenceProviderClassName + " in classloader " + classLoader, e);
        } catch (InstantiationException e) {
            persistenceUnitInfo.destroy();
            throw new PersistenceException("Could not create PersistenceProvider instance: " + persistenceProviderClassName + " loaded from classloader " + classLoader, e);
        } catch (IllegalAccessException e) {
            persistenceUnitInfo.destroy();
            throw new PersistenceException("Could not create PersistenceProvider instance: " + persistenceProviderClassName + " loaded from classloader " + classLoader, e);
        }
        this.transactionManager = transactionManager;
    }
View Full Code Here

TOP

Related Classes of javax.persistence.PersistenceException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.