[hibernate] Probleme acces a ma base SQL
Alors voila mon probleme
j'ai generé le mapping de ma base mysql via hibernate, mais des que j essaie d'y acceder il me dit qu il ne trouve pas la base.
Voila a quoi ressemble produit.hbm.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
|
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<!--
Auto-generated mapping file from
the hibernate.org cfg2hbm engine
-->
<class name="net.test.centrale.hibernate.Produit" table="produit" catalog="test">
<id name="prodId" type="integer">
<column name="prod_id" />
<generator class="assigned" />
</id>
<property name="prodLibelle" type="string">
<column name="prod_libelle" length="100" not-null="true" />
</property>
<property name="prodStock" type="integer">
<column name="prod_stock" not-null="true" />
</property>
<set name="estCommanders" inverse="true">
<key>
<column name="prod_id" not-null="true" />
</key>
<one-to-many class="net.test.centrale.hibernate.EstCommander" />
</set>
</class>
</hibernate-mapping> |
voila le moment ou ca pete :
Code:
1 2 3 4 5 6
|
Session session = HibernateUtil.currentSession();
Transaction tx = session.beginTransaction();
Query query = session.createQuery("from Produit");
System.out.println(query.list().size()); |
et voila le log :
Code:
1 2 3 4
|
...
ERROR [JDBCExceptionReporter] Base table or view not found message from server: "Table 'test.test__produit' doesn't exist"
... |
voila :roll: