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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:47:20+00:00 2026-05-26T09:47:20+00:00

I have created a simple java web (Vaadin) application project using JPA and it

  • 0

I have created a simple java web (Vaadin) application project using JPA and it works for reading entities from database. When I try to use either persist() or merge(), nothing happens in database.
When looking at the logs, there are SELECT queries, but no INSERT / UPDATE.

I am using Glassfish 3.1 with JDBC resource defined, persistence.xml to use that resource (JTA).
I am using default configuration files, generated automatically by Eclipse.

There is also another similar project done by someone else, uses the same JTA and this problem does not appear. Looked over its configuration and didn’t find anything important.

Both projects do not use transactions.

persistence.xml

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.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_2_0.xsd">
<persistence-unit name="MapperPersistence">
    <jta-data-source>mapper</jta-data-source>
         <class>pl.bdk.mapper.domain.jpaImpl.MappingImpl</class>
...
         <class>pl.bdk.mapper.domain.jpaImpl.UserImpl</class>
             <properties>
                 <property name="eclipselink.logging.level" value="FINE" />
             </properties>
    </persistence-unit>
</persistence>

Java code

public class MappingService {
    public static int createMapping(String clientProductId, User user) {
        MappingImpl mapping = new MappingImpl();
        mapping.setUser(user);
        mappingDao.save(mapping);
        return mapping.getMappingId();
    }
}

...
public class MappingDao {
    public void save(MappingImpl mapping) {
        entityManager.persist(mapping);
    }
}

...
@Entity
@Table("t_mapping")
public class MappingImpl() {
    @Id
    @SequenceGenerator(name="T_MAPPING_MAPPINGID_GENERATOR", sequenceName="S_MAPPING_ID", allocationSize=1)
    @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="T_MAPPING_MAPPINGID_GENERATOR")
    private Integer id;

    @ManyToOne
    @JoinColumn(name="user_id")
    private User user;

... getters and setters...
}
  • 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-05-26T09:47:21+00:00Added an answer on May 26, 2026 at 9:47 am

    OK, the matter seemed simple, but it isn’t.

    This post helped me a lot: Hibernate doesn't save and doesn't throw exceptions?

    First of all – JPA needs some kind of transaction mechanism. Normally it is managed underneath and needs no setup.
    This means the easiest way is to create an EJB (Enterprise Java Bean) project, where EntityManager would be injected with @PersistenceContext. If one prefers to create the EntityManager locally (no EJB), a transaction mechanism still has to be provided. More info in the above post.

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

Sidebar

Related Questions

I have a simple Java web application using HSQLDB embedded database. The application is
I have created some simple app in Java, and 'deployed' it using Java Web
I have created a simple web-service using Java. i want to load jars related
I have just created a mid-sized web-application using Java, a custom MVC framework, javascript.
I have created simple Java Dynamic Web project in Eclipse. I host my project
Could someone help me on this, I have created simple web services using axis2
I have a very simple ASP.NET web application created under Visual Studio 2008 (SP1),
I have a simple web application in which I have created a wizard, each
I have created a dynamic web project in Eclipse and have written a simple
A hobby project of mine is a Java web application. It's a simple web

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.