Results 1 to 3 of 3

Thread: EntityManager in JpaDaoSupport

  1. #1
    Join Date
    Jan 2006
    Posts
    2

    Question EntityManager in JpaDaoSupport

    hey guys.

    Am using spring-framework-2.0-m2-with-dependencies-build.398-20060118.zip as a starting point for playing around with Hibernate EM and Spring support.

    Question:
    How do i get an EM from within a service bean extending JpaDaoSupport? I used the getEntityManager method of JpaDaoSupport and it returned null. I also tried getJpaTemplate().getEntityManager(). It also returned null.
    thus this mean that i should just create an EM from the EM factory. But my guess is this wont participate in transactions that may be ongoing.

  2. #2
    Join Date
    Jul 2007
    Posts
    5

    Default

    Have the same problem.
    Should EntityManager be injected the way EntityManagerFactory is injected into all my DAOs?

    Thanks,

  3. #3
    Join Date
    Jan 2006
    Posts
    2

    Default

    use getJpaTemplate().execute and implement the jpacallback.

    you will be passed an valid em w/c participates in txs

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •