Код: Выделить всё
########## Error with java.lang.ClassCastException:
java.util.ArrayList cannot be cast to [Ljava.lang.Object; ##########
Size 1
Код: Выделить всё
try {
File file = new File(filePath + "ABC.txt");
BufferedReader br = new BufferedReader(new FileReader(file));
String st;
List list = new ArrayList();
try {
while ((st = br.readLine()) != null) {
String id = st.substring(92, 100);
try {
list.add(getDetail(id));
} catch (Exception e) {
e.printStackTrace();
}
for (Object[] o : (List) list) {
Details x = new Details();
x.setType(o[0].toString());
....
}
}
br.close();
} catch (Exception ex) {
logger.printError(Reader.class, "Error with " + ex);
}
logger.printInfo(Reader.class, "Size " + list.size());
} catch (IOException ex) {
ex.printStackTrace();
}
Код: Выделить всё
public List getDetail(int id){
StringBuilder bf = new StringBuilder();
bf.append("SELECT ");
bf.append("'ABC', ");
....
return em.createQuery(bf.toString()) .getResultList();
}
Подробнее здесь: https://stackoverflow.com/questions/475 ... ang-object