Bonjour à tous,

J'ai des problèmes pour récupérer des données contenues dans Oracle, je vous donne la table qui me pose des soucis :

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
create type type_materiel_loue as object
(
	num_materiel int
);
 
create type tab_materiel_loue as table of type_materiel_loue
 
create table location
(
    num_location int,
    date_location date,
    heure_debut int, 
    heure_fin int, check(heure_fin>heure_debut),
    materiel tab_materiel_loue,
    id_personne int,
    prix_paye int,
    constraint pk_location primary key (num_location),
    constraint fk_location_id_personne foreign key(id_personne) references personne(id_personne)
) 
nested table materiel store as tab_materiel_loc;
J'aimerais récupérer les valeurs du champ matériel mais je n'y arrive pas. J'ai suivi les indications données ici . Voila ce que ça me donne :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
Array array = resultat.getArray("materiel");
Object tableau = array.getArray();
TypeMaterielLoue[] donneesTableau = (TypeMaterielLoue[])tableau;
for(int i=0; i<donneesTableau.length ; i++){
	System.out.println(donneesTableau[i]);
}
java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [LCoeur.Mat.TypeMaterielLoue;
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
 
Array array = resultat.getArray("materiel");
ResultSet tableau = array.getResultSet();
while(tableau.next()){
        System.out.println((TypeMaterielLoue)tableau.getObject(1));
}
java.lang.ClassCastException: java.math.BigDecimal cannot be cast to Coeur.Mat.TypeMaterielLoue


Voila j'espère que quelqu'un pourra m'éclairer sur mon probleme

Cordialement