-->
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.  [ 5 posts ] 
Author Message
 Post subject: List u = q.list() doesnt get executed
PostPosted: Sat Sep 04, 2004 4:17 pm 
Regular
Regular

Joined: Sat May 29, 2004 2:16 pm
Posts: 81
Hibernate version:
2.1


Mapping documents:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping
PUBLIC "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping>
<class name = "escola.Utilizador" table = "utilizadores">
<id name = "id" column = "id" unsaved-value = "null">
<generator class = "increment" />
</id>
<many-to-one
name = "relatorio"
column = "rel_relatorios"
class = "escola.Relatorio"
cascade = "all">
</many-to-one>
<property name = "nomeUtilizador" column = "nomeUtilizador" />
<property name = "nomeCompleto" column = "nomeCompleto" />
<property name = "palavraPasse" column = "palavraPasse" />
<property name = "perfil" column = "perfil" />
</class>
</hibernate-mapping>

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping
PUBLIC "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class name = "escola.Turma" table = "turmas">
<id name = "id" column = "id" unsaved-value = "null">
<generator class = "increment" />
</id>
<property name = "obs" column = "obs" />
<property name = "ciclo" column = "ciclo" />
<property name = "autor" column = "autor" />
<property name = "leI" column = "leI" />
<property name = "leII" column = "leII" />
<property name = "q1" column = "q1" />
<property name = "q2" column = "q2" />
<property name = "q3" column = "q3" />
<property name = "q4" column = "q4" />
<property name = "q5" column = "q5" />
<property name = "q6" column = "q6" />
<property name = "q7" column = "q7" />
<property name = "q8" column = "q8" />
<property name = "q16" column = "q16" />
<property name = "q18" column = "q18" />
<property name = "q25" column = "q25" />
<property name = "q26" column = "q26" />
<property name = "q27" column = "q27" />
<property name = "q28" column = "q28" />
<property name = "q29" column = "q29" />
<property name = "q30" column = "q30" />
<property name = "q31" column = "q31" />
<property name = "q32" column = "q32" />
<property name = "q33_1" column = "q33_1" />
<property name = "q33_2" column = "q33_2" />
<property name = "q33_3" column = "q33_3" />
<property name = "q33_4" column = "q33_4" />
<property name = "q33_5" column = "q33_5" />
<property name = "q33_6" column = "q33_6" />
<property name = "q33_7" column = "q33_7" />
<property name = "q33_8" column = "q33_8" />
<property name = "q33_9" column = "q33_9" />
<property name = "q33_10" column = "q33_10" />
<property name = "q33_11" column = "q33_11" />
<property name = "q33_12" column = "q33_12" />
<property name = "q33a_1" column = "q33a_1" />
<property name = "q33a_2" column = "q33a_2" />
<property name = "q33a_3" column = "q33a_3" />
<property name = "q33a_4" column = "q33a_4" />
<property name = "q33a_5" column = "q33a_5" />
<property name = "q33a_6" column = "q33a_6" />
<property name = "q33a_7" column = "q33a_7" />
<property name = "q33a_8" column = "q33a_8" />
<property name = "q33a_9" column = "q33a_9" />
<property name = "q33a_10" column = "q33a_10" />
<property name = "q33a_11" column = "q33a_11" />
<property name = "q33a_12" column = "q33a_12" />
<property name = "q35" column = "q35" />
<property name = "q36" column = "q36" />
<property name = "q37" column = "q37" />
<property name = "q38" column = "q38" />
<property name = "q41_EE" column = "q41_EE" />
<property name = "q41_Al" column = "q41_Al" />
<property name = "q42" column = "q42" />
<property name = "q43" column = "q43" />
<property name = "q44" column = "q44" />
<property name = "q45_1" column = "q45_1" />
<property name = "q45_2" column = "q45_2" />
<property name = "q45_3" column = "q45_3" />
<property name = "q45_4" column = "q45_4" />
<property name = "q45_5" column = "q45_5" />
<property name = "q45_6" column = "q45_6" />
<property name = "q45_7" column = "q45_7" />
<property name = "q47" column = "q47" />
<property name = "q48" column = "q48" />
<property name = "q49" column = "q49" />
<property name = "q50" column = "q50" />
<property name = "q51" column = "q51" />
<property name = "q51a" column = "q51a" />
<property name = "q52" column = "q52" />
<property name = "q53" column = "q53" />
<property name = "q54" column = "q54" />
<property name = "q55" column = "q55" />
<property name = "q56" column = "q56" />
<property name = "q57" column = "q57" />
<property name = "q58" column = "q58" />
<property name = "q59" column = "q59" />
<property name = "q60" column = "q60" />
<property name = "q60a" column = "q60a" />
<property name = "q61" column = "q61" />
<property name = "q62" column = "q62" />
<property name = "q74" column = "q74" />
<property name = "q76" column = "q76" />
<property name = "q77" column = "q77" />
<property name = "q78" column = "q78" />
<property name = "q79" column = "q79" />
<property name = "q80" column = "q80" />
<property name = "q82" column = "q82" />
<property name = "q83" column = "q83" />
<property name = "q84" column = "q84" />
<property name = "q86" column = "q86" />
<property name = "q87" column = "q87" />
<property name = "q88" column = "q88" />
<property name = "q89" column = "q89" />
<property name = "q90" column = "q90" />
<property name = "q91" column = "q91" />
<property name = "q93" column = "q93" />
<property name = "q94" column = "q94" />
<set name = "q9" lazy = "true" cascade = "all-delete-orphan">
<key column = "turma_id" />
<one-to-many class = "escola.Q9" />
</set>
<set name = "q10" lazy = "true" cascade = "all-delete-orphan">
<key column = "turma_id" />
<one-to-many class = "escola.Q10" />
</set>
<set name = "q12" lazy = "true" cascade = "all-delete-orphan">
<key column = "turma_id" />
<one-to-many class = "escola.Q12" />
</set>
<set name = "q17" lazy = "true" cascade = "all-delete-orphan">
<key column = "turma_id" />
<one-to-many class = "escola.Q17" />
</set>
<set name = "q19" lazy = "true" cascade = "all-delete-orphan">
<key column = "turma_id" />
<one-to-many class = "escola.Q19" />
</set>
<set name = "q34" lazy = "true" cascade = "all-delete-orphan">
<key column = "turma_id" />
<one-to-many class = "escola.Q34" />
</set>
<set name = "q22Disc"
lazy = "true"
cascade = "all-delete-orphan"
order-by = "estrategia">
<key column = "turma_id" />
<one-to-many class = "escola.Q22Disc" />
</set>
</class>
</hibernate-mapping>


<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration
PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">

<hibernate-configuration>
<session-factory>
<!-- properties -->
<property name="hibernate.show_sql">false</property>
<!-- mapping files -->
<mapping resource = "escola/Acessorios.hbm.xml"/>
<mapping resource = "escola/Relatorio.hbm.xml"/>
<mapping resource = "escola/Turma.hbm.xml"/>
<mapping resource = "escola/EducacaoArtistica.hbm.xml"/>
<mapping resource = "escola/EducacaoFisica.hbm.xml"/>
<mapping resource = "escola/EducacaoMoralEReligiosa.hbm.xml"/>
<mapping resource = "escola/EducacaoMusical.hbm.xml"/>
<mapping resource = "escola/Matematica.hbm.xml"/>
<mapping resource = "escola/LinguaPortuguesa.hbm.xml"/>
<mapping resource = "escola/LEI.hbm.xml"/>
<mapping resource = "escola/Q9.hbm.xml"/>
<mapping resource = "escola/Q10.hbm.xml"/>
<mapping resource = "escola/Q12.hbm.xml"/>
<mapping resource = "escola/Q17.hbm.xml"/>
<mapping resource = "escola/Q19.hbm.xml"/>
<mapping resource = "escola/Q22Al.hbm.xml"/>
<mapping resource = "escola/Q22Disc.hbm.xml"/>
<mapping resource = "escola/Q22EE.hbm.xml"/>
<mapping resource = "escola/Q22Esc.hbm.xml"/>
<mapping resource = "escola/Q23.hbm.xml"/>
<mapping resource = "escola/Q34.hbm.xml"/>
<mapping resource = "escola/Utilizador.hbm.xml"/>
</session-factory>
</hibernate-configuration>



Code between sessionFactory.openSession() and session.close():class Porteiro {

FrameLogin frame;
Utilizador ut;
FrameA a;

public Porteiro(FrameLogin f) {
frame = f;
}

public Porteiro(FrameA fa) {
a = fa;
}

public Porteiro() {
}

public void setUt(Utilizador ut) {
this.ut = ut;
}

public Utilizador getUt() {
return ut;
}

public Utilizador getUtilizadorDt() throws HibernateException {

Acessorios a;
Session sess = Utilitarios.currentSession();

String queryepocaActual = "select a from Acessorios as a";
List l = sess.find(queryepocaActual);
a = (Acessorios) l.get(0);
int epocaActual = a.getEpocaActual();
System.out.println("


Top
 Profile  
 
 Post subject:
PostPosted: Sat Sep 04, 2004 4:25 pm 
Regular
Regular

Joined: Sat Aug 28, 2004 4:15 pm
Posts: 61
Are you sure that an exception doesnt get thrown before the print after?

When a line of code that "should" get executed doesnt, you can usually bet on an Exception. Surely you have all this in a try catch block. Are you simply catching all exceptions?

_________________
Joe W


Top
 Profile  
 
 Post subject:
PostPosted: Sat Sep 04, 2004 4:27 pm 
Regular
Regular

Joined: Sat May 29, 2004 2:16 pm
Posts: 81
well, the stacktrace says NPE, because i need an object that isnt created


Top
 Profile  
 
 Post subject:
PostPosted: Sat Sep 04, 2004 4:31 pm 
Regular
Regular

Joined: Sat May 29, 2004 2:16 pm
Posts: 81
when i push a ceratin button that code should be executed:
here's how i have it:
[code] public FrameA() {
enableEvents(AWTEvent.WINDOW_EVENT_MASK);
controlaBotoes = new ControlaBotoes(this);
controlaBotoes.comuta(false);
try {

jbInit();
// isto aqui n


Top
 Profile  
 
 Post subject:
PostPosted: Sat Sep 04, 2004 4:35 pm 
Regular
Regular

Joined: Sat May 29, 2004 2:16 pm
Posts: 81
CASE SOLVED
never mind, i had a typo
thanks anyway!


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

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.