Bonjour à tous,
J'ai un problème de rollback: j'ai deux entités client et adresse avec une relation unidirectionnelle de client vers adresse (relation oneToMany).
J'ai trois table:
- client
- adresse
- client_adresse: cette dernière fait la liason entre les deux tables cité plus haut.
Lorsque j'ajoute un client avec une adresse et que j'ai un problème de transaction (voulue car deux client identique), une entré n'est pas ajouté ni dans la table client ni dans la table client_adresse. Par contre une entrée est ajouté dans la table adresse. Il n'y a pas de rollback complet et il semble donc qu'il y ait un autocommit.
Je n'arrive pas à trouver la cause de ce problème.
A noter : il n'y a pas ce problème avec le même code et les mêmes fichiers de conf (à part la conf jndi du au driver mysql) chez un developpeur sous Windows (je suis sous Linux). J'envisage donc que ce problème est lié à mon Mysql ?? Mais je n'arrive pas à le résoudre.
Ci dessous quelques fichiers de configurations de mon application:
Fichier persistence.xml:
Fichier sun-ressources.xml:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12 <?xml version="1.0" encoding="UTF-8"?> <persistence version="2.0" 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_2_0.xsd"> <persistence-unit name="EcomPU" transaction-type="JTA"> <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider> <jta-data-source>JNDI_mysql</jta-data-source> <exclude-unlisted-classes>false</exclude-unlisted-classes> <properties> <property name="eclipselink.ddl-generation" value="drop-and-create-tables"/> </properties> </persistence-unit> </persistence>
Depuis phpMyAdmin, j'ai accés en lecture aux variable du serveur Mysql.
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 <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE resources PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 9.0 Resource Definitions //EN" "http://www.sun.com/software/appserver/dtds/sun-resources_1_3.dtd"> <resources> <!--connection-validation-method="auto-commit"--> <jdbc-connection-pool allow-non-component-callers="false" associate-with-thread="false" connection-creation-retry-attempts="0" connection-creation-retry-interval-in-seconds="10" connection-leak-reclaim="false" connection-leak-timeout-in-seconds="0" datasource-classname="com.mysql.jdbc.jdbc2.optional.MysqlDataSource" fail-all-connections="false" idle-timeout-in-seconds="300" is-connection-validation-required="false" is-isolation-level-guaranteed="true" lazy-connection-association="false" lazy-connection-enlistment="false" match-connections="false" max-connection-usage-count="0" max-pool-size="32" max-wait-time-in-millis="60000" name="mysql_ecom_JixmannschaftPool" non-transactional-connections="false" pool-resize-quantity="2" res-type="javax.sql.DataSource" statement-timeout-in-seconds="-1" steady-pool-size="8" validate-atmost-once-period-in-seconds="0" wrap-jdbc-objects="false"> <property name="serverName" value="localhost"/> <property name="portNumber" value="3306"/> <property name="databaseName" value="ecom"/> <property name="User" value="Jixmannschaft"/> <property name="Password" value="linux"/> <property name="URL" value="jdbc:mysql://localhost:3306/ecom"/> <property name="driverClass" value="com.mysql.jdbc.Driver"/> </jdbc-connection-pool> <jdbc-resource enabled="true" jndi-name="JNDI_mysql" object-type="user" pool-name="mysql_ecom_JixmannschaftPool"/> </resources>
A noter la variable autocmmit est à ON (comme sous l'user windows avec qui il n'y a pas de problème de rollback. Je n'arrive pas à la passer à OFF, mais je doute donc que ce soit la cause du problème.
Je peut poster tout code ou toute configurations supplémentaire.
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291 auto increment increment 1 auto increment offset 1 autocommit ON automatic sp privileges ON back log 50 basedir /usr/ big tables OFF binlog cache size 32 768 binlog direct non transactional updates OFF binlog format MIXED bulk insert buffer size 8 388 608 character set client utf8 character set connection utf8 character set database utf8 character set filesystem binary character set results utf8 character set server utf8 character set system utf8 character sets dir /usr/share/mysql/charsets/ collation connection utf8_unicode_ci collation database utf8_unicode_ci collation server utf8_unicode_ci completion type 0 concurrent insert 1 connect timeout 10 datadir /var/lib/mysql/ date format %Y-%m-%d datetime format %Y-%m-%d %H:%i:%s default week format 0 delay key write ON delayed insert limit 100 delayed insert timeout 300 delayed queue size 1 000 div precision increment 4 engine condition pushdown ON error count 0 event scheduler OFF example enum var e1 example ulong var 8 expire logs days 0 flush OFF flush time 0 foreign key checks ON ft boolean syntax + -><()~*:""&| ft max word len 84 ft min word len 4 ft query expansion limit 20 ft stopword file (built-in) general log OFF general log file /var/run/mysql/mysqld.log group concat max len 1 024 have community features YES have compress YES have crypt YES have csv YES have dynamic loading YES have geometry YES have innodb YES have ndbcluster DISABLED have openssl DISABLED have partitioning YES have query cache YES have rtree keys YES have ssl DISABLED have symlink YES hostname linux identity 0 ignore builtin innodb OFF init connect init file init slave innodb adaptive hash index ON innodb additional mem pool size 1 048 576 innodb autoextend increment 8 innodb autoinc lock mode 1 innodb buffer pool size 8 388 608 innodb checksums ON innodb commit concurrency 0 innodb concurrency tickets 500 innodb data file path ibdata1:10M:autoextend innodb data home dir innodb doublewrite ON innodb fast shutdown 1 innodb file io threads 4 innodb file per table OFF innodb flush log at trx commit 1 innodb flush method innodb force recovery 0 innodb lock wait timeout 50 innodb locks unsafe for binlog OFF innodb log buffer size 1 048 576 innodb log file size 5 242 880 innodb log files in group 2 innodb log group home dir ./ innodb max dirty pages pct 90 innodb max purge lag 0 innodb mirrored log groups 1 innodb open files 300 innodb rollback on timeout OFF innodb stats on metadata ON innodb support xa ON innodb sync spin loops 20 innodb table locks ON innodb thread concurrency 8 innodb thread sleep delay 10 000 innodb use legacy cardinality algorithm ON insert id 0 interactive timeout 28 800 join buffer size 131 072 keep files on create OFF key buffer size 16 777 216 key cache age threshold 300 key cache block size 1 024 key cache division limit 100 language /usr/share/mysql/english/ large files support ON large page size 0 large pages OFF last insert id 0 lc time names en_US license GPL local infile ON locked in memory OFF log OFF log bin ON log bin trust function creators OFF log bin trust routine creators OFF log error /var/log/mysql/mysqld.log log output FILE log queries not using indexes OFF log slave updates OFF log slow queries OFF log warnings 1 long query time 10 low priority updates OFF lower case file system OFF lower case table names 0 max allowed packet 1 048 576 max binlog cache size 4 294 963 200 max binlog size 1 073 741 824 max connect errors 10 max connections 151 max delayed threads 20 max error count 64 max heap table size 16 777 216 max insert delayed threads 20 max join size 4 294 967 295 max length for sort data 1 024 max prepared stmt count 16 382 max relay log size 0 max seeks for key 4 294 967 295 max sort length 1 024 max sp recursion depth 0 max tmp tables 32 max user connections 0 max write lock count 4 294 967 295 min examined row limit 0 multi range count 256 myisam data pointer size 6 myisam max sort file size 2 146 435 072 myisam mmap size 4 294 967 295 myisam recover options OFF myisam repair threads 1 myisam sort buffer size 8 388 608 myisam stats method nulls_unequal myisam use mmap OFF ndb autoincrement prefetch sz 1 ndb cache check time 0 ndb connectstring ndb extra logging 0 ndb force send ON ndb index stat cache entries 32 ndb index stat enable OFF ndb index stat update freq 20 ndb report thresh binlog epoch slip 3 ndb report thresh binlog mem usage 10 ndb use copying alter table OFF ndb use exact count ON ndb use transactions ON net buffer length 8 192 net read timeout 30 net retry count 10 net write timeout 60 new OFF old OFF old alter table OFF old passwords OFF open files limit 1 024 optimizer prune level 1 optimizer search depth 62 optimizer switch index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on pid file /var/run/mysql/mysqld.pid plugin dir /usr/lib/mysql/plugin port 3 306 preload buffer size 32 768 profiling OFF profiling history size 15 protocol version 10 pseudo thread id 311 (Valeur globale) 0 query alloc block size 8 192 query cache limit 1 048 576 query cache min res unit 4 096 query cache size 0 query cache type ON query cache wlock invalidate OFF query prealloc size 8 192 rand seed1 rand seed2 range alloc block size 4 096 read buffer size 262 144 read only OFF read rnd buffer size 524 288 relay log relay log index relay log info file relay-log.info relay log purge ON relay log space limit 0 report host report password report port 3 306 report user rpl recovery rank 0 secure auth OFF secure file priv server id 1 skip external locking ON skip name resolve OFF skip networking OFF skip show database OFF slave compressed protocol OFF slave exec mode STRICT slave load tmpdir /var/tmp/mysql.Dapy7K slave net timeout 3 600 slave skip errors OFF slave transaction retries 10 slow launch time 2 slow query log OFF slow query log file /var/run/mysql/mysqld-slow.log socket /var/run/mysql/mysql.sock sort buffer size 524 288 sql auto is null ON sql big selects ON sql big tables OFF sql buffer result OFF sql log bin ON sql log off OFF sql log update ON sql low priority updates OFF sql max join size 4 294 967 295 sql mode sql notes ON sql quote show create ON sql safe updates OFF sql select limit 4 294 967 295 sql slave skip counter sql warnings OFF ssl ca ssl capath ssl cert ssl cipher ssl key storage engine MyISAM sync binlog 0 sync frm ON system time zone CET table definition cache 256 table lock wait timeout 50 table open cache 64 table type MyISAM thread cache size 0 thread handling one-thread-per-connection thread stack 196 608 time format %H:%i:%s time zone SYSTEM timed mutexes OFF timestamp 1 290 943 669 tmp table size 16 777 216 tmpdir /var/tmp/mysql.Dapy7K transaction alloc block size 8 192 transaction prealloc size 4 096 tx isolation REPEATABLE-READ unique checks ON updatable views with limit YES version 5.1.46-log version comment SUSE MySQL RPM version compile machine i686 version compile os suse-linux-gnu wait timeout 28 800 warning count 0
Merci d'avance pour votre aide
Partager