-->
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.  [ 9 posts ] 
Author Message
 Post subject: A problem with the variable sql_show
PostPosted: Wed Mar 17, 2004 10:22 am 
Newbie

Joined: Wed Mar 17, 2004 10:14 am
Posts: 14
Location: France
Hello,
Hibernate Version 2.1
i have a problem with the variable sql_show hibernate.cfg.xml
Even it is in true I can't have sql errors details,
this is my hibernate.cfg.xml:


<!DOCTYPE hibernate-configuration
PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">

<hibernate-configuration>

<session-factory>

<property name="hibernate.show_sql">true</property>
<property name="hibernate.">true</property>
<property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="hibernate.connection.url">jdbc:oracle:thin:*****</property>
<property name="hibernate.connection.username">*****</property>
<property name="hibernate.connection.password">*****</property>
<property name="hibernate.connection.pool_size">5</property>
<property name="hibernate.dialect">net.sf.hibernate.dialect.OracleDialect</property>


<!-- <property name="hibernate.hbm2ddl.auto">update</property>-->


<!-- Mapping files -->
<mapping resource="PS.hbm.xml"/>

</session-factory>

</hibernate-configuration>


How can I have debug mode fof sql Errors?
thinks in advance.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 17, 2004 10:33 am 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
have you configured log4j?

are you looking at console or log files?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 17, 2004 10:36 am 
Newbie

Joined: Wed Mar 17, 2004 10:14 am
Posts: 14
Location: France
I didn't configure log4j, I'm looking in the console.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 17, 2004 10:40 am 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
humm strange, do you see mapping trace at startup?

take a look at log files


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 17, 2004 10:46 am 
Newbie

Joined: Wed Mar 17, 2004 10:14 am
Posts: 14
Location: France
i can see the mapping trace this is the trace i have , i can have some sql trace like:
[SQL] insert into ****** (SERVERID, DIFFSTARTDATE, DIFFENDDATE, RETAIN, PRIORITY, CONTENTID) values (?, ?, ?, ?, ?, ?)
Hibernate: insert into ***** (SERVERID, DIFFSTARTDATE, DIFFENDDATE, RETAIN, PRIORITY, CONTENTID) values (?, ?, ?, ?, ?, ?)
2004-03-17 15:32:13,402 DEBUG [BatcherImpl] preparing statement

that's all, I cant insert into the database, the problem is that i can see why(errors details).


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 17, 2004 10:51 am 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
Quote:
I can't have sql errors details

show sql only enable sql query trace.

to know which db error happens, code a printStackTrace on catch blocks

Are you sure there is an error?

Are you committing?

You should show us the code you are using before and after doing your insert (session.save i suppose)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 17, 2004 10:57 am 
Newbie

Joined: Wed Mar 17, 2004 10:14 am
Posts: 14
Location: France
this is my code (i use System.out.... to debug):

content.setContentId(1);
content.setServerId(1);
content.setDiffStartDate(1);
content.setDomAF("aaaaaaaaaaaaaa");
content.setDiffEndDate(1);
content.setRetain(1);
content.setPriority(1);
System.out.println("step1");
session.save(content);
System.out.println("step2");
tx.commit();
System.out.println("step3");
HibernateUtil.closeSession();
System.out.println("step4");

when i execute this code i can see:
step1
step2


that's all , this mean that i dosn't ccommit.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 17, 2004 11:01 am 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
do you have a try/catch block?

in fact an exception is thrown calling commit(), how are you retrieving the session? are you sure you need to save the object (or just update it)?

Are you coding under eclipse?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 17, 2004 11:04 am 
Newbie

Joined: Wed Mar 17, 2004 10:14 am
Posts: 14
Location: France
ok thinks;


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 9 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.