Bonjour à tous,
je me tourne vers car comme à chaque fois vous me semblez être la solution de dernier. J'ai beau retourner le problème dans tous les sens et demander à tous le monde, nos compétences ne sont pas suffisantes. Alors voilà la bête :
J'ai une belle RollbackException qui est levée lorsque le programme tente un update sur une table. En voici la trace :Les select quant à eux fonctionnent très bien, et le truc marrant c'est que cette erreur je ne l'ai que sur certains environnement, sur d'autres le programme marche à merveille. Du coup j'irais bien regarder du côté des configs hibernate et/ou oracle mais je ne sais pas par quel bout commencer ...
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12 javax.persistence.RollbackException: Error while commiting the transaction at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:71) at com.sfr.rprm.services.impl.AccountingVoucherImpl.updateProformaGenerationStep(AccountingVoucherImpl.java:156) at $AccountingVoucherServices_12255d911b3.updateProformaGenerationStep($AccountingVoucherServices_12255d911b3.java) at $AccountingVoucherServices_12255d911b1.updateProformaGenerationStep($AccountingVoucherServices_12255d911b1.java) ... Caused by: java.lang.ClassCastException: com.sfr.rprm.persistence.Party at org.hibernate.type.StringType.toString(StringType.java:44) at org.hibernate.type.NullableType.toLoggableString(NullableType.java:218) ... at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106) at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:54)
Cette différence de comportement entre les environnements ainsi que les moultes vérifications notamment au niveau du mapping me font penser que le code est bon, mais au cas où, le voici :
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 public class AccountingVoucherImpl extends AbstractService implements AccountingVoucherServices { public AccountingVoucherImpl() { super(); } public List<AccountingVoucher> findAllAccountingVouchers() { final List<AccountingVoucher> accountingVoucher = getEM().createNamedQuery(AccountingVoucher.FIND_ALL).getResultList(); if (accountingVoucher.size() > 0) { return accountingVoucher; } else { return null; } } public int updateProformaGenerationStep(Integer id, Long value) { getEM().getTransaction().begin(); int i=(getEM().createNamedQuery(AccountingVoucher.PROFORMA_GENERATION_STEP) .setParameter("id", id) .setParameter("proformaGenerationStepValue", value) .executeUpdate()); getEM().getTransaction().commit(); return i; } }
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 @Entity @Table(name = "ST_ACCOUNTING_VOUCHER") @NamedQueries({ @NamedQuery(name = "AccountingVoucher.findAll", query = "SELECT a FROM AccountingVoucher a"), @NamedQuery(name = "AccountingVoucher.updateProformaGenerationStep", query = "UPDATE AccountingVoucher a SET a.proformaGenerationStep = :proformaGenerationStepValue WHERE a.id = :id" ) }) public class AccountingVoucher { public static String FIND_ALL = "AccountingVoucher.findAll"; public static String PROFORMA_GENERATION_STEP = "AccountingVoucher.updateProformaGenerationStep"; @Id @Basic(optional = false) @Column(name = "ACCOUNTING_VOUCHER_ID") private Integer id; @ManyToOne @JoinColumn(name="VENDOR_ID") private Party vendor; @ManyToOne @JoinColumn(name="BUYER_ID") private Party buyer; @Column(name = "PROFORMA_GENERATION_STEP") private Long proformaGenerationStep; }D'avance merci à tous pour quelque participation que ce soit !
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14 @Entity public class Party implements Serializable { @ManyToOne @JoinColumn(name="BUYER_ID") private Party buyer; @Id @Column(name="PARTY_ID", nullable = false) private String partyId; @ManyToOne @JoinColumn(name="VENDOR_ID") private Party vendor; }
Partager