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.  [ 2 posts ] 
Author Message
 Post subject: Différence de résultats entre requêtes SQL et Criteria
PostPosted: Fri Aug 04, 2006 8:06 am 
Newbie

Joined: Thu Aug 03, 2006 4:38 am
Posts: 6
Bonjour,

Je voudrais savoir comment on peut vider le cache car j'ai l'impression que mon probléme vient de là.
Quand je fais la requête via la fonction createSQLQuery j'ai 2 résultats (ce que je devrai avoir) et 1 par createCriteria !

Quand je fais
[...]
session.createSQLQuery( "select * from COUNTRY" ).list().size();
[...]
ça me donne 2
et quand je fais
[...]
Transaction transaction = session.beginTransaction();
session.createCriteria( Country.class ).list().size();
transaction.commit();
session.close();
[...]
ça me donne 1 ! !

Et mon fichier hibernate.cfg.xml est :
[code]
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>

<session-factory>

<!-- connexion base de donnée -->
<property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="connection.url">jdbc:oracle:thin:@XXXXX:1521:YYYY</property>
<property name="connection.username">CCCC</property>
<property name="connection.password">DDDD</property>

<!-- dialect SQL -->
<property name="dialect">org.hibernate.dialect.OracleDialect</property>
<property name="cache">org.hibernate.cache.NoCacheProvider</property>


<!-- affichage des requete SQL -->
<property name="show_sql">false</property>

</session-factory>
</hibernate-configuration>
[code]

Merci de m'indiquer une "parade"
[/code]


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 18, 2006 5:28 pm 
Regular
Regular

Joined: Fri Aug 18, 2006 2:40 pm
Posts: 51
Location: Metz, France
session.clear() ?


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