Bonjour à tous.
depuis hier je suis confronté à un probleme mes requetes s'executesnt à l'exxception des requetes d'update et de remove. ca me prend la tete.
Si quelqu'un veut bien m'aider svp. Voici ma configuration:
le model
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
68 <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" ...> <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"> <property name="driverClassName" value="com.mysql.jdbc.Driver" /> <property name="url" value="jdbc:mysql://localhost:3306/test" /> <property name="username" value="root" /> <property name="password" value="" /> </bean> <!-- SessionFactory Hibernate Integration --> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"> <property name="dataSource" ref="dataSource" /> <property name="annotatedClasses"> <list> <value>com.application.data.supervisionJSF.model.Antenne</value> <value>com.application.data.supervisionJSF.model.User</value> </list> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop> <prop key="hibernate.show_sql">true</prop> <prop key="hibernate.bytecode.use_reflection_optimizer">true</prop> <prop key="hibernate.cache.provider_class">org.hibernate.cache.HashtableCacheProvider</prop> <prop key="hibernate.sql_comments">true</prop> <prop key="hibernate.format_sql">true</prop> </props> </property> </bean> <!-- Gestion des transactions --> <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory" ref="sessionFactory" /> </bean> <tx:annotation-driven transaction-manager="transactionManager" /> <!-- proxy for DAO using generic DAO --> <bean id="proxyDAO" abstract="true"> <property name="sessionFactory" ref="sessionFactory" /> </bean> <bean id="AntenneService" class="com.application.data.supervisionJSF.service.impl.AntenneServiceImpl" parent="proxyDAO"> <constructor-arg value="com.application.data.supervisionJSF.model.Antenne" /> </bean> <bean id="userService" class="com.application.data.supervisionJSF.service.impl.UserServiceImpl" parent="proxyDAO"> <constructor-arg value="com.application.data.supervisionJSF.model.User" /> </bean> <!-- Transactional proxy for Services --> <bean id="proxyService" abstract="true" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="transactionManager" ref="transactionManager" /> <property name="transactionAttributes"> <props> <prop key="find*">PROPAGATION_REQUIRED, readOnly</prop> <prop key="get*">PROPAGATION_REQUIRED, readOnly</prop> <prop key="*">PROPAGATION_REQUIRED, -java.lang.Exception</prop> </props> </property> </bean> <!-- Utilise les annotations dans tous les context --> <context:annotation-config /> <!-- Scanne le package des models pour les classes de la BD --> <context:component-scan base-package="com.application.data.supervisionJSF" /> </beans>
l'interface GenericDao
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 @Entity @Table(name = "antenne", catalog = "test") public class Antenne implements java.io.Serializable { private static final long serialVersionUID = -127279406857241506L; private Integer id; private String nom; public Antenne() { } public Antenne(String nom) { this.nom = nom; } @Id @GeneratedValue(strategy = IDENTITY) @Column(name = "id", unique = true, nullable = false) public Integer getId() { return this.id; } public void setId(Integer id) { this.id = id; } @Column(name = "nom", nullable = false, length = 20) public String getNom() { return this.nom; } public void setNom(String nom) { this.nom = nom; } }
la classe service
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7 public interface GenericDao<T, PK extends Serializable> { PK save(T newInstance); T findById(PK id); List<T> findAll(); void update(T transientObject); void remove(T persistentObject); }
la classe d'implementation
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4 public interface AntenneService extends GenericDao<Antenne, Integer>{ public List<Antenne> findAllEnabled(); public List<Antenne> search(String searchString); }
Le probleme c'est qu'il nya pas pas de message d'erreur généré alors je me demande pourquoi toutes les requetes marchent à l'exeption de update et delete
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 @Transactional @Service("AntenneService") public class AntenneServiceImpl extends GenericDaoImpl<Antenne, Integer>implements AntenneService,Serializable{ private static final long serialVersionUID = 6513868518270496030L; public AntenneServiceImpl(Class<Antenne> type) { super(type); } public AntenneServiceImpl() { super(); } public List<Antenne> findAllEnabled() { return null; } public List<Antenne> search(String searchString) { return null; } }
merci
Partager