Bonjour
je suis entrain de developper une petite application jee (hibernate3, spring)
j'ai fais la classe article et son dao
j'ai configuré le fichier HibernateDataAccessContext.xml

quand je run l'application, aucun erreur et la base ne genere pas
voila la classe article.java

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
55
56
57
58
59
 
package com.bd.entity;
 
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
 
@Entity
@Table(name="Articlet")
public class Article {
 
	int id;
	String nom;
	String type;
	int qte;
 
 
	public Article() {
		super();
		// TODO Auto-generated constructor stub
	}
	@Id
	@GeneratedValue
	 @Column(name="ID")
	public int getId() {
		return id;
	}
 
	public void setId(int id) {
		this.id = id;
	}
	 @Column(name="Nom")
	public String getNom() {
		return nom;
	}
	public void setNom(String nom) {
		this.nom = nom;
	}
	 @Column(name="Type")
	public String getType() {
		return type;
	}
	public void setType(String type) {
		this.type = type;
	}
	 @Column(name="Qunatité")
	public int getQte() {
		return qte;
	}
	public void setQte(int qte) {
		this.qte = qte;
	}
 
 
 
 
}


et articledao.java
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
 
package com.bd.dao;
 
import java.util.Collection;
import java.util.List;
 
 
 
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
 
import com.bd.entity.Article;
@Repository
@Transactional
@Configuration
public class ArticleDaoImp implements ArticleDao {
 
	@Autowired
	SessionFactory sessionFactory;
 
	@SuppressWarnings("unchecked")
	@Transactional(readOnly = true)
	public List<Article> getAll() {
 
		return sessionFactory.getCurrentSession().createQuery("from Article")
				.list();
	}
 
	@Transactional(readOnly = true)
	public Article getById(int articleId) {
 
		return (Article) sessionFactory.getCurrentSession().get(Article.class,
				articleId);
	}
 
	@Override
	public void save(Article article) {
		sessionFactory.getCurrentSession().merge(article);
 
	}
 
	@Override
	public void delete(Article article) {
		sessionFactory.getCurrentSession().delete(article);
 
	}
 
}


et le fichier hibernateDataAccessContext.java

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
55
56
57
58
59
60
61
62
63
64
65
66
67
 
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context"
    xmlns:jee="http://www.springframework.org/schema/jee" xmlns:tx="http://www.springframework.org/schema/tx"
    xsi:schemaLocation="
      <a href="http://www.springframework.org/schema/beans" target="_blank">http://www.springframework.org/schema/beans</a> <a href="http://www.springframework.org/schema/beans/spring-beans-2.5.xsd" target="_blank">http://www.springframework.org/schem...-beans-2.5.xsd</a>
      <a href="http://www.springframework.org/schema/context" target="_blank">http://www.springframework.org/schema/context</a> <a href="http://www.springframework.org/schema/context/spring-context-2.5.xsd" target="_blank">http://www.springframework.org/schem...ontext-2.5.xsd</a>
      <a href="http://www.springframework.org/schema/jee" target="_blank">http://www.springframework.org/schema/jee</a> <a href="http://www.springframework.org/schema/jee/spring-jee-2.5.xsd" target="_blank">http://www.springframework.org/schem...ng-jee-2.5.xsd</a>
      <a href="http://www.springframework.org/schema/tx" target="_blank">http://www.springframework.org/schema/tx</a> http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
 
  <!-- Auto-detect the DAOs -->
  <context:component-scan base-package="com.bd.dao"/>
 
 
  <context:property-placeholder location="WEB-INF/jdbc.properties"/>
 
 
	<bean id="dataSource"
		class="org.springframework.jdbc.datasource.DriverManagerDataSource">
		<property name="driverClassName" value="${database.driver}" />
		<property name="url" value="${database.url}" />
		<property name="username" value="${database.user}" />
		<property name="password" value="${database.password}" />
	</bean>
 
 
 
  	<bean id="sessionFactory"
		class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
		<property name="dataSource" ref="dataSource" />
		<property name="annotatedClasses">
 
				<value>com.bd.entity.Article</value>
 
 
		</property>
		<property name="hibernateProperties">
			<props>
				<prop key="hibernate.dialect">${hibernate.dialect}</prop>
				<prop key="hibernate.show_sql">${hibernate.show_sql}</prop>		
				<!-- generation base donnée 	<prop key="hibernate.hbm2ddl.auto">create-drop</prop> -->
		<prop key="hibernate.hbm2ddl.auto">create-drop</prop>
 
			</props>
		</property>
		<property name="articleListeners">
      <map>
        <entry key="merge">
          <bean class="org.springframework.orm.hibernate3.support.IdTransferringMergeArticleListener"/>
        </entry>
      </map>
    </property>
	</bean>
 
 
 
 
  <tx:annotation-driven transaction-manager="txnManager"/>
 
  <bean id="txnManager"
        class="org.springframework.orm.hibernate3.HibernateTransactionManager"
        p:sessionFactory-ref="sessionFactory"/>
 
  <bean class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor"/>
 
</beans>



et jdbc.properties

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
 
database.driver=com.mysql.jdbc.Driver
database.url=jdbc:mysql://localhost:3306/ccccc
database.user=root
database.password=root
hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
hibernate.show_sql=true



aide moi svp
merci