最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

jpa - configure an eclipselink non-JTA sequence connection pool without jndi or persistance.xml - Stack Overflow

matteradmin4PV0评论

I am trying to find way to set eclipselink sequence pool datasource programmatically and not using JNDI (spring application deployed on cloud foundry). i need to set datasource explicitly as creation of datasource needs certificate authentication to postgres (on GCP)etc.

can we set DataSource to property 'eclipselink.jdbc.sequence-connection-pool.non-jta-data-source' instead of jndi name?

   LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
        factory.setPersistenceUnitName("int_portal");
        factory.setJpaVendorAdapter(jpaVendorAdapter);
        factory.setJpaDialect(new EclipseLinkJpaDialect());

        factory.setDataSource(dataSource);
        factory.setLoadTimeWeaver(loadTimeWeaver);
        factory.setJtaDataSource(dataSource);

        // PersistenceUnitProperties.CONNECTION_POOL_SEQUENCE;
        Map<String, Object> propMap = factory.getJpaPropertyMap();

        propMap.put("eclipselink.weaving", "false");
        propMap.put(PersistenceUnitProperties.SESSION_CUSTOMIZER, IPSessionCustomizer.class.getName());
        *propMap.put("eclipselink.jdbc.sequence-connection-pool", "true");
        propMap.put("eclipselink.jdbc.sequence-connection-pool.non-jta-data-source", "java:/comp/env/jdbc/intDB");

Post a comment

comment list (0)

  1. No comments so far