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 8013797
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T19:43:52+00:00 2026-06-04T19:43:52+00:00

I have an JEE5 app using EJB3 with JPA. E.g I have some beans

  • 0

I have an JEE5 app using EJB3 with JPA. E.g I have some beans with

@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)

I’d like to write some tests for those services. I know I can use embeddable container like OpenEJB, but as JPA is available in Java SE, I wonder if I can use it in testing?
Certainly I won’t have all the

@PersistenceContext, @PersistenceUnit, @TransactionAttribute

features available. So my question is if this is worth trying (hand-made transaction management and so on)? Or should I go with embedded container? I’m talking about integration tests (with real, but in-memory database), not about mocking all stuff around.

EDIT:

One more thing as I’m quite new to testing in embedded container. Is it possible to inject e.g. Mockito’s mock as an @EJB dependency to my bean under test? Or maybe it doesn’t make sense in this setup?

  • 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-04T19:43:53+00:00Added an answer on June 4, 2026 at 7:43 pm

    You can test a lot of things with Java SE / JPA. But there is a major part of what we call Integration Testing that will require massive amount of effort to mock up things, and some that just won’t be doable without Arquillian or similar help. Do you want your EJB transactional functionality/etc to be included among the things you test? If so you have to implement tests that lives in a transactional environment as close to production as possible. I strongly suggest using a ejb-testing-framework.

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

Sidebar

Related Questions

I have a JEE5 application that exposes services using (local) session beans. When an
Have some code: using (var ctx = new testDataContext()) { var options = new
have some headers like: HTTP/1.1 100 Continue HTTP/1.1 302 Found HTTP/1.1 200 OK HTTP/1.1
We have developed a JEE5 web application (WAR) and running it in production under
have been trying couple of hours now to make my iphone app universal. The
Have a really weird one here. The app has two targets, just to be
have a php code like this,going to convert it in to C#. function isValid($n){
Have advancements in CPU design like dynamic instruction scheduling narrowed the performance gap between
Have some dates in my local Oracle 11g database that are in this format:
Have any one tried to activate fancybox thumbnail gallery using a button or an

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.