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

  • Home
  • SEARCH
  • 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 9164041
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T14:35:10+00:00 2026-06-17T14:35:10+00:00

I am using openejb as my standalone container to run my unit testcases, in

  • 0

I am using openejb as my standalone container to run my unit testcases, in all the test in all the tests i was able to retrieve the values but not able to insert or update. Even if i try entitymanager.merge(obj), it is selecting the value correctly but it is not updating it.

I am new to this , so please help me with this error

thanks in advance

my persistence.xml file

 <persistence-unit name="test"
        transaction-type="JTA">
        <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
        <jta-data-source>java:/OracleDS</jta-data-source>
.....entity classes.....
<properties>
            <property name="eclipselink.target-server" value="JBoss" />
            <property name="eclipselink.target-database" value="Oracle" />
            <property name="eclipselink.logging.level" value="FINE" />
            <property name="eclipselink.logging.parameters" value="true" />
        </properties>
    </persistence-unit>  

my dao method

tp.setname("van");
tp.settype("vehicle");
//entityManager.getTransaction().begin();
entityManager.merge(tp);
//entityManager.getTransaction().commit();
  • 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-17T14:35:12+00:00Added an answer on June 17, 2026 at 2:35 pm

    Do the followings for

    Persist new entity:

    Transport tp = new Transport();
    tp.setname("van");
    tp.settype("vehicle");
    entityManager.getTransaction().begin();  
    entityManager.persist(tp);
    entityManager.getTransaction().commit();
    

    Update existing entity:

    Query qry = entityManager.createQuery("Select t from 
                                           Transport t where t.type ='vechicle'");
    List list = qry.getResultList();
    //assume result return single entity
    Transport tp = list.get(0);
    tp.setInspectionDone(new Date()) ;
    entityManager.getTransaction().begin();
    entityManager.merge(tp);
    entityManager.getTransaction().commit();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a specific problem with an unit test using embedded OpenEJB container. I
I have a problem. I'm learning JPA. I'm using embedded OpenEJB container in unit
Using the Redis info command, I am able to get all the stats of
So I'm using container managed transactions in OpenEJB and Hibernate and I have a
I am using openEjb in embedded mode to test a stateless session bean, which
We are using OpenEJB clients that connect to one OpenEJB server container. The OpenEJB
Embedding OpenEJB in a TestCase using javax.ejb.embeddable.EJBContainer. EJBContainer container = EJBContainer.createEJBContainer(); always returns null.
I'm trying to (unit) test my EJB class without having to startup my websphere
Using getDefinitionByName I am consistently getting the error saying it is not defined (as
I have several stateless session beans I have created unit tests for. When I

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.