Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7864903
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T23:55:40+00:00 2026-06-02T23:55:40+00:00

currently I’m fooling around with a Spring setup. My goal is to use JPA

  • 0

currently I’m fooling around with a Spring setup. My goal is to use JPA to get access to a Websphere datasource using it’s JNDI name. I’m using Spring Data JPA to make life easier for me and worked through some tutorials to get the basic idea.

Bad thing: none of those is talking about the Spring configuration for my JPA szenario + I never worked with JPA / JDBC before.
So I hope you can help me out here. I got 2 configuration files:

applicationContext.xml

<bean id="txManager"
    class="org.springframework.orm.jpa.JpaTransactionManager">
    <property name="sessionFactory" ref="sessionFactory" />
</bean>
<tx:annotation-driven transaction-manager="txManager" />

<bean id="eManager" class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean"></bean>

Since i’m using the @Transactual annotion within my code, i’m using the annotation-driven tag for the txManager. I’m just not really sure what else i should configure for the txManager and what the sessionFactory tag is doing. Is there any documentation for all supported XML tags? Am I missing a importent tag for my szenario?

Same about eManager – not sure if thats right in any way.

persistence.xml

<persistence version="1.0"
    xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
    <persistence-unit name="spring-jpa">
        <jta-data-source>jdbc/myJNDI</jta-data-source>
    </persistence-unit>
</persistence>

Same thing here: don’t really know what i’m doing. I know i need a persistence unit / provider. I know that many are using hibernate for this, but i would like to stay native and use pure JavaEE / Spring if possible.
I’m just not sure how to configure that.
Currently my project is crashing, telling me: “JPA PersistenceProvider returned null”

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T23:55:41+00:00Added an answer on June 2, 2026 at 11:55 pm

    The best way is to obtain the EntityManagerFactory from the JNDI via Spring’s JNDI support:

    <jee:jndi-lookup id="entityManagerFactory" jndi-name="persistence/myPersistenceUnit" />
    
    <jpa:repositories base-package="com.acme.repositories" />
    
    <tx:jta-transactionManager />
    

    This will cause the transaction manager being used from the application server as well. You can also try to setup a JpaTransactionManager and wire the EntityManagerFactory obtained from JNDI into it. You can pull even more configuration into your Spring config files if you only lookup the datasource through an <jee:jndi-lookup /> namespace element and follow the further configuration instructions in the Spring Data JPA reference documentation. Nevertheless it’s usually better to use the container resources you can actually get if you decide to use container resources at all.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Currently we use log4net of version 1.2.10.0 and we should start using some 3rd
currently I am trying to make it so that I can get access to
Currently I am using HTML files for parts of my user interface. I display
currently, I`m implementing a map App with Mono4Droid and there I`m using a WebView
Currently I am trying to use a bunch of custom perl modules, test.pm as
Currently, I am using the following command to change dos2unix line endings, but this
Currently, I'm working on to get a list of all running applications. I've been
Currently if i have dependency project opened, then maven use it instead of specified
Currently we are using Trac . Tickets are good for tracking tasks and related
I want use html5's new tag to play a wav file (currently only supported

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.