Package org.springframework.orm.jpa

Examples of org.springframework.orm.jpa.JpaTemplate


      Environment env) {
    final KnowledgeSessionConfiguration localConf = conf == null ? new SessionConfiguration() : conf;
    this.env = env;
    checkEnvironment(env);
    TransactionTemplate txTemplate = new TransactionTemplate(transactionManager);
    jpaTemplate = new JpaTemplate((EntityManagerFactory) env.get(EnvironmentName.ENTITY_MANAGER_FACTORY));
    txTemplate.execute(new TransactionCallback() {
      public Object doInTransaction(TransactionStatus status) {
        return jpaTemplate.execute(new JpaCallback() {

          public Object doInJpa(EntityManager em) throws PersistenceException {
View Full Code Here


    protected void validate() {
        ObjectHelper.notNull(getEntityManagerFactory(), "entityManagerFactory");
    }

    protected JpaTemplate createTemplate() {
        return new JpaTemplate(getEntityManagerFactory());
    }
View Full Code Here

        overdueEndpoint = getMockEndpoint("mock:overdue");
        overdueEndpoint.setResultWaitTime(20000);
    }

    protected RouteBuilder createRouteBuilder() throws Exception {
        JpaTemplate jpaTemplate = getMandatoryBean(JpaTemplate.class, "jpaTemplate");
        TransactionTemplate transactionTemplate = getMandatoryBean(TransactionTemplate.class, "transactionTemplate");

        // START SNIPPET: example
        return new ProcessBuilder(jpaTemplate, transactionTemplate) {
            public void configure() throws Exception {
View Full Code Here

    this.entityManagerFactory = emf;
  }

  private synchronized JpaTemplate getJpaTemplate()
  {
    JpaTemplate jpaTemplate = new JpaTemplate(entityManagerFactory);
    return jpaTemplate;
  }
View Full Code Here

    private List<?> getResults(Persistable<?> value, String propertyName) {
        String entityName = getEntityName(value);
        if (!value.isNew()) { // TODO: wrong semantic
            String pkAttributeName = getPkAttributeName(value.getClass());
            String query = format("from %s where %s = ? and %s != ?", entityName, propertyName, pkAttributeName);
            return new JpaTemplate(entityManager).find(query,
                    new BeanWrapperImpl(value).getPropertyValue(propertyName), value.getId());
        } else {
            String query = format("from %s where %s = ?", entityName, propertyName);
            return new JpaTemplate(entityManager)
                    .find(query, new BeanWrapperImpl(value).getPropertyValue(propertyName));
        }
    }
View Full Code Here

   * @param entityManagerFactory the JPA EntityManagerFactory to create a JpaTemplate for
   * @return the new JpaTemplate instance
   * @see #setEntityManagerFactory
   */
  protected JpaTemplate createJpaTemplate(EntityManagerFactory entityManagerFactory) {
    return new JpaTemplate(entityManagerFactory);
  }
View Full Code Here

   * @param entityManager the JPA EntityManager to create a JpaTemplate for
   * @return the new JpaTemplate instance
   * @see #setEntityManagerFactory
   */
  protected JpaTemplate createJpaTemplate(EntityManager entityManager) {
    return new JpaTemplate(entityManager);
  }
View Full Code Here

        overdueEndpoint = getMockEndpoint("mock:overdue");
        overdueEndpoint.setResultWaitTime(20000);
    }

    protected RouteBuilder createRouteBuilder() throws Exception {
        JpaTemplate jpaTemplate = getMandatoryBean(JpaTemplate.class, "jpaTemplate");
        TransactionTemplate transactionTemplate = getMandatoryBean(TransactionTemplate.class, "transactionTemplate");

        // START SNIPPET: example
        return new ProcessBuilder(jpaTemplate, transactionTemplate) {
            public void configure() throws Exception {
View Full Code Here

TOP

Related Classes of org.springframework.orm.jpa.JpaTemplate

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.