-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Problem... Please Help !!!!
PostPosted: Sun Jul 03, 2011 10:22 pm 
Newbie

Joined: Sun Jul 03, 2011 10:02 pm
Posts: 1
I'm new to hibernate and I'm using db-derby 10.7.1.1 and I have a little problem. I've got a database with 3 tables with data that I need and 2 tables that hibernate created for auto incrementation.

the thing is I need to populate a jtable with the data that I've got in one table but I'm getting an exception:
Hibernate: select cartemodel0_.codcarte as codcarte8_, cartemodel0_.Autor as Autor8_, cartemodel0_.imprumut as imprumut8_, cartemodel0_.titlu as titlu8_ from CarteModel cartemodel0_
Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 0 >= 0


the table name in the database is CarteModel and the columns are : codcarte-int auto increments, autor-String, imprumut-int, titlu-String

the code that I use to get the data from the data base is:

@SuppressWarnings("unchecked")
public List<CarteModel> ListaCarti(){
AnnotationConfiguration conn = new AnnotationConfiguration();
conn.addAnnotatedClass(CarteModel.class);
conn.configure();
SessionFactory sesiune = conn.buildSessionFactory();
Session ses = sesiune.getCurrentSession();
ses.beginTransaction();
Query query = ses.createQuery("from CarteModel ");

List<CarteModel> lista_c ;

lista_c = query.list();

ses.getTransaction().commit();
return lista_c;
}


and the code to put the data in the jtable is :

CarteRepository crtrep = new CarteRepository();
CarteTableModel crttblmdl = new CarteTableModel(crtrep.ListaCarte());
CarteController crtctrl = new CarteController();

tableModel = new DefaultTableModel();
table.setModel(crttblmdl);
table = new JTable(tableModel);
jScrollPane1.setViewportView(table);
table.setFillsViewportHeight(true);


please help


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.