Hibernate Annotations 3.2.1
J'essaie de faire fonctionner l'application HelloWorld du chapitre 2 de Hibernate in Action, dans Eclipse 3.2.1. L'application fonctionne avec les fichiers de mapping hbm et cfg. Mais avec les Annotations et persitence.xml, j'obtiens l’erreur suivante à l’éxécution:
Exception in thread "main" javax.persistence.PersistenceException: No Persistence provider for EntityManager named helloworld
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:55)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:33)
at hello.HelloWorld.main(HelloWorld.java:11)
Merci, et bon temps des fêtes
Hibernate Annotations 3.2.1
Merci pour votre participation. Voici le fichier persistence.xml
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
| <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_1_0.xsd"
version="1.0">
<persistence-unit name="helloworld">
<!-- The provider only needs to be set if you use several JPA providers
<provider>org.hibernate.ejb.HibernatePersistence</provider>
-->
<!-- This is required to be spec compliant, Hibernate however supports
auto-detection even in JSE.
<class>hello.Message</class>
-->
<properties>
<!-- Scan for annotated classes and Hibernate mapping XML files -->
<property name="hibernate.archive.autodetection" value="class, hbm"/>
<!-- SQL stdout logging -->
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.format_sql" value="true"/>
<property name="use_sql_comments" value="true"/>
<property name="hibernate.connection.driver_class"
value="com.microsoft.jdbc.sqlserver.SQLServerDriver"/>
<property name="hibernate.connection.url"
value="jdbc:microsoft:sqlserver://mimoza:1433"/>
<property name="hibernate.connection.username"
value="user1"/>
<property name="hibernate.connection.password"
value="password"/>
<property name="hibernate.c3p0.min_size"
value="5"/>
<property name="hibernate.c3p0.max_size"
value="20"/>
<property name="hibernate.c3p0.timeout"
value="300"/>
<property name="hibernate.c3p0.max_statements"
value="50"/>
<property name="hibernate.c3p0.idle_test_period"
value="3000"/>
<property name="hibernate.dialect"
value="org.hibernate.dialect.SQLServerDialect"/>
</properties>
</persistence-unit>
</persistence> |
Hibernate Annotations 3.2.1
Salut Vincent,
Problème résolu. Effectivement les deux derniers jar étaient absents. Merci beaucoup. Je dois dire que j'ai mal lu le readme.txt. Mea culpa.
Pour ton information, dans mon fichier hibernate-3.2\lib\_README.txt il n’y a aucune référence au jboss-archive-browsing. Parmi les 4 entrées jboss-xxx.jar qui s’y trouvent, j’ai choisi jboss-common.jar et cela a réglé le problème.
Merci à toute la communauté developpez.com
eljin