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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T20:49:08+00:00 2026-06-06T20:49:08+00:00

Using Play! Framework 2.0.2, when I add several items from my java project to

  • 0

Using Play! Framework 2.0.2, when I add several items from my java project to my H2 test database I only see one single item in the ITEM table. The single item being the last entry that i’ve persisted. I thought that this my be due the db being recreated at every commit. I therefor thought of adding the JPA.ddl=update property in my application.conf file. But this simply breaks with the following error. What

Here is my code (in the Item.save() method):

package models;

import java.math.BigDecimal;

import javax.persistence.Entity;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Persistence;

@Entity
public class Item {

    @Id
    @GeneratedValue(strategy=GenerationType.AUTO)
    public int id;
    public String name;
    public String dev;
    public String type;
    public int quantity;
    public BigDecimal unitPrice;

    public Item() {}

    public Item(String name, String dev, String type, int quantity,
            BigDecimal unitPrice) {
        super();
        this.name = name;
        this.dev = dev;
        this.type = type;
        this.quantity = quantity;
        this.unitPrice = unitPrice;
    }

    /**
     * Insert this new computer.
     */
    public void save() {
        //this.id = id;
        EntityManagerFactory entityManagerFactory = Persistence.createEntityManagerFactory("defaultPersistenceUnit");
        EntityManager entityManager = entityManagerFactory.createEntityManager();
        entityManager.getTransaction().begin();
        entityManager.persist(this);        
        entityManager.getTransaction().commit();
        entityManager.close();
    }
}

Here is the error message

Caused by: javax.persistence.PersistenceException: No Persistence provider for EntityManager named update
        at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:69) ~[hibernate-jpa-2.0-api-1.0.1.Final.jar:1.0.1.
Final]
        at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:47) ~[hibernate-jpa-2.0-api-1.0.1.Final.jar:1.0.1.
Final]
        at play.db.jpa.JPAPlugin.onStart(JPAPlugin.java:35) ~[play_2.9.1.jar:2.0.2]
        at play.api.Play$$anonfun$start$1.apply(Play.scala:60) ~[play_2.9.1.jar:2.0.2]
        at play.api.Play$$anonfun$start$1.apply(Play.scala:60) ~[play_2.9.1.jar:2.0.2]
        at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59) ~[scala-library.jar:0.11.3]
  • 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-06T20:49:10+00:00Added an answer on June 6, 2026 at 8:49 pm

    I believe you’re going to need a persistence.xml file to be contained within your /conf/META-INF/ directory, and from there need to define a persistence unit. I believe this is because you’re using Hibernate correct?

    An example of what yours can look like

    <persistence 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"
                 version="2.0">
    
        <persistence-unit name="update">
            <provider>org.hibernate.ejb.HibernatePersistence</provider>
            <properties>
                <property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/>
                <property name="hibernate.hbm2ddl.auto" value="update"/>
                <property name="hibernate.connection.url" value="jdbc:h2:mem:events"/>
            </properties>
        </persistence-unit>
    
    </persistence>
    

    In your tag you’ll also need to include any <jar-file> or <class> you are to be using as well.

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

Sidebar

Related Questions

play framework: 1.2.3 Hi, I am trying to purge my database by using play's
I'm trying to test a model method using Play Framework 2.0 and Specs2. Global.scala
Is there any better way to handle Exceptions using Play framework apart from what
I am using Play Framework 2.0.1. I have created a Java application using the
I am using Hibernate 4.1.3 (JPA) on the Play! framework. The database is PostgreSQL
I'm using JPA through the Play Framework. I'm checking to see if a User
I'm using the Play Framework and taking a text from a textarea and I
Writing a Java application using the Play framework and need some HTTP-Live streaming. I
How can I join two tables by using java play framework and jpa, I
I'm using the Play Framework for a little project. It has a dependency to

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.