These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]

Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Jpa with Hibernate using eclipse Kepler
PostPosted: Thu Jul 03, 2014 12:22 pm 

Joined: Mon Jun 23, 2014 11:47 am
Posts: 1
Hello iam trying to implement jpa using hibernate in eclipse kepler
here is my entity class
package com.jpa;

import java.io.Serializable;
import javax.persistence.*;

* Entity implementation class for Entity: jpaexample

public class jpaexample {
    @GeneratedValue(strategy = GenerationType.IDENTITY)
     private Long id;
    private String summary;
    public String getSummary() {
        return summary;
    public void setSummary(String summary) {
        this.summary = summary;

And my persisting class

package com.jpa;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

public class persistjpa {
    public static void main(String[] args)
        EntityManagerFactory factory=Persistence.createEntityManagerFactory("JpaExamples");
        EntityManager em = factory.createEntityManager();
        jpaexample f=new jpaexample();
        f.setSummary("jpa test");



And my persistence.xml file

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
    <persistence-unit name="JpaExamples" transaction-type="RESOURCE_LOCAL">
            <property name="hibernate.connection.username" value="sa"/>
            <property name="hibernate.connection.password" value="google"/>
            <property name="hibernate.connection.url" value="jdbc:sqlserver://localhost:1433;databaseName=rithishdb"/>
            <property name="hibernate.connection.driver_class" value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
            <property name="javax.persistence.jdbc.url" value="jdbc:sqlserver://localhost:1433;databaseName=rithishdb"/>
            <property name="javax.persistence.jdbc.user" value="sa"/>
            <property name="javax.persistence.jdbc.password" value="google"/>
            <property name="javax.persistence.jdbc.driver" value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
            <property name="hibernate.dialect" value="org.hibernate.dialect.SQLServerDialect"/>

And the following error i get like this

Exception in thread "main" javax.persistence.PersistenceException: No Persistence provider for EntityManager named JpaExamples
    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:61)
    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:39)
    at com.jpa.persistjpa.main(persistjpa.java:13)

Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.