Bonjour,
Je suis en train de tester une application (simple affichage à partir d'une base de données SQL Server), j'utilise Hibernate, et jtds comme driver.
Lorsque j’exécute mon programme j'obtiens l'exception suivante :


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
69
70
71
72
73
74
75
76
 
 
 
Infos: building session factory
oct. 20, 2014 11:30:15 PM org.hibernate.impl.SessionFactoryObjectFactory addInstance
Infos: Not binding factory to JNDI, no JNDI name configured
oct. 20, 2014 11:30:15 PM org.hibernate.type.NullableType nullSafeGet
Infos: could not read column value from result set: M23_0_0_; Value 4110702013007059E cannot be converted to INTEGER.
oct. 20, 2014 11:30:16 PM org.hibernate.util.JDBCExceptionReporter logExceptions
Avertissement: SQL Error: 0, SQLState: 22000
oct. 20, 2014 11:30:16 PM org.hibernate.util.JDBCExceptionReporter logExceptions
Grave: Value 4110702013007059E cannot be converted to INTEGER.
Exception in thread "AWT-EventQueue-0" org.hibernate.exception.DataException: could not execute query
	at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:102)
	at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
	at org.hibernate.loader.Loader.doList(Loader.java:2452)
	at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2192)
	at org.hibernate.loader.Loader.list(Loader.java:2187)
	at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:119)
	at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1706)
	at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:347)
	at com.pchalle.classeMetier.MDossier.afficherDossiersParExerciceEtTypeOp(MDossier.java:340)
	at com.pchalle.fenetre.AccueilFen$2.actionPerformed(AccueilFen.java:75)
	at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
	at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
	at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
	at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
	at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
	at java.awt.Component.processMouseEvent(Unknown Source)
	at javax.swing.JComponent.processMouseEvent(Unknown Source)
	at java.awt.Component.processEvent(Unknown Source)
	at java.awt.Container.processEvent(Unknown Source)
	at java.awt.Component.dispatchEventImpl(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
	at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
	at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
	at java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.awt.Window.dispatchEventImpl(Unknown Source)
	at java.awt.Component.dispatchEvent(Unknown Source)
	at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
	at java.awt.EventQueue.access$200(Unknown Source)
	at java.awt.EventQueue$3.run(Unknown Source)
	at java.awt.EventQueue$3.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
	at java.awt.EventQueue$4.run(Unknown Source)
	at java.awt.EventQueue$4.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.sql.SQLException: Value 4110702013007059E cannot be converted to INTEGER.
	at net.sourceforge.jtds.jdbc.Support.convert(Support.java:752)
	at net.sourceforge.jtds.jdbc.JtdsResultSet.getInt(JtdsResultSet.java:675)
	at net.sourceforge.jtds.jdbc.JtdsResultSet.getInt(JtdsResultSet.java:1002)
	at org.hibernate.type.IntegerType.get(IntegerType.java:51)
	at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:186)
	at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:175)
	at org.hibernate.type.ManyToOneType.hydrate(ManyToOneType.java:158)
	at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:2267)
	at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1443)
	at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1371)
	at org.hibernate.loader.Loader.getRow(Loader.java:1271)
	at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:619)
	at org.hibernate.loader.Loader.doQuery(Loader.java:745)
	at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:270)
	at org.hibernate.loader.Loader.doList(Loader.java:2449)
	... 43 more
En googlant, j'ai pu comprendre que peut être, il y a un problème au niveau des types des variables.
Sachant que j'ai utilisé la Reverse Engineering, pour générer les classes métiers (et par la suite le types des variables est géré par Hibernate), avez vous une idée de la source du problème.
Merci