facebook

No Persistence provider for EntityManager named persistence1

  1. MyEclipse Archived
  2.  > 
  3. Database Tools (DB Explorer, Hibernate, etc.)
Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #270169 Reply

    Hello, I’m trying the JPA from the MyEclipse 5.5M2, and I’ve found some problems, like this kind off error, and what I’ve to do to fix this. Is only a test
    Here is my XML :
    <?xml version=”1.0″ encoding=”UTF-8″?>
    <persistence xmlns=”http://java.sun.com/xml/ns/persistence&#8221;
    xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance&#8221;
    xsi:schemaLocation=”http://java.sun.com/xml/ns/persistence
    http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd&#8221; version=”1.0″>

    <persistence-unit name=”persistence1″ transaction-type=”RESOURCE_LOCAL”>
    <provider>mysql.toplink.essentials.PersistenceProvider</provider>
    <class>entity.Login</class>
    <class>entity.Client1</class>

    <properties>
    <property name = “toplink.jdbc.driver” value = “com.mysql.jdbc.Driver”/>
    <property name = “toplink.jdbc.url” value = “jdbc:mysql://127.0.0.1:3306/client”/>
    <property name = “toplink.jdbc.user” value = “root”/>
    <property name = “toplink.jdbc.password” value = “test”/>
    </properties>
    </persistence-unit>
    </persistence>

    Part of client program client :
    // Create EntityManagerFactory for persistent unit named “pu1”
    // to be used in this test
    emf = Persistence.createEntityManagerFactory(“persistence1”);

    // Persist all entities
    createTransactionalEntityManager();
    System.out.println(“Inserting Customer and Orders… ” + testInsert());
    closeTransactionalEntityManager();
    .
    .
    .

    #270227 Reply

    Riyad Kalla
    Member

    <provider>mysql.toplink.essentials.PersistenceProvider</provider>

    The problem is your persistence provide is invalid… it should be something like:

    oracle.toplink.essentials.PersistenceProvider
    #270272 Reply

    Ok Tnhks
    However now I’d have another problem… I’d can get connected on my MySQL, but I just can do the insert of new records, and use the findid, all the other issues like delete, update, doesnt work. And the strange is, after I did the delete, the programa show to me that are all fine, and if I’d try one another findid he throw one erro to me, but after I go and check on the database, the register still there!!!
    Thank you

    #270274 Reply

    Riyad Kalla
    Member

    It sounds like you need to make use of transactions with your inserts and deletes. It looks like:

    
    EntityManagerHelper.beginTransaction();
    <YOUR SAVE or DELETE OPERATION>
    EntityManagerHelper.commit();
    
    #270283 Reply

    Man,
    I`m really have to say thank you. I know that I`’m young on this API, and I`d still a lot to learn and I`d either know that is a stupid thing.
    Once again thank you.

    #270284 Reply

    Riyad Kalla
    Member

    No problem. Using persistence APIs (this can happen with hibernate too) has some little “quirks” to it, but once you figure them out you can just start banging out the persistence code without much of a problem.

    The first time I ever ran into that issue “why aren’t my values changing!?” it took me a lot of crazy to figure out I needed transactions 😉

    #277854 Reply

    This message has not been recovered.

    #277896 Reply

    Riyad Kalla
    Member

    This message has not been recovered.

    #277905 Reply

    This message has not been recovered.

    #277987 Reply

    Riyad Kalla
    Member

    This message has not been recovered.

Viewing 10 posts - 1 through 10 (of 10 total)
Reply To: No Persistence provider for EntityManager named persistence1

You must be logged in to post in the forum log in