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: probleme criteria construction requet SQL
PostPosted: Fri Jan 05, 2007 11:31 am 
Newbie

Joined: Thu Nov 30, 2006 12:21 pm
Posts: 14
Bonjour,
j'ai un probleme avec les Criteria , dans mon application j'exécute une requete SQL via l'API Criteria n fois et chaque fois avec des parametres différentes , au bout de la 9ième requete mon criteria ne retourne rien et l'application reste planter ...je comprend vraiment pas se qui se passe , j'ai mi ci dessous la trace des logs avec le level DEBUG.

Hibernate version:3.2

database : SQL Server

The generated SQL (show_sql=true):



Code:
2007-01-05 15:57:46,702 [DEBUG] com.webtiss.sita.sgp.business.impl.SiteOperationBusiness:224 - doPrepareFilter - Emplacement id : 304
2007-01-05 15:57:46,702 [DEBUG] com.webtiss.sita.sgp.business.impl.SiteOperationBusiness:254 - 35
2007-01-05 15:57:46,702 [DEBUG] org.springframework.orm.hibernate3.SessionFactoryUtils:333 - Opening Hibernate Session
2007-01-05 15:57:46,702 [DEBUG] org.hibernate.impl.SessionImpl:220 - opened session at timestamp: 4784165137211392
2007-01-05 15:57:46,702 [DEBUG] com.webtiss.sita.sgp.dao.hibernate.CollecteDAOHibernate:70 - getAll CollecteDAOHibernate without op criteria
2007-01-05 15:57:46,702 [DEBUG] com.webtiss.sita.sgp.dao.hibernate.CollecteDAOHibernate:73 - after
2007-01-05 15:57:46,702 [DEBUG] org.hibernate.jdbc.AbstractBatcher:358 - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
2007-01-05 15:57:46,718 [DEBUG] org.hibernate.jdbc.ConnectionManager:415 - opening JDBC connection
2007-01-05 15:57:46,718 [DEBUG] org.hibernate.SQL:393 - select this_.id as id9_0_, this_.ano_id as ano2_9_0_, this_.regroup_ano_id as regroup3_9_0_, this_.commentaire as commenta4_9_0_, this_.date_heure as date5_9_0_, this_.destination_id as destinat6_9_0_, this_.emplacement_id as emplacem7_9_0_, this_.etiq_cont_id as etiq8_9_0_, this_.qte_cont as qte9_9_0_, this_.qte_dechet as qte10_9_0_, this_.regoup_comment as regoup11_9_0_, this_.regroup_date_heure as regroup12_9_0_, this_.operateur_id as operateur13_9_0_ from collecte this_ where this_.emplacement_id=? and this_.date_heure between ? and ?
Hibernate: select this_.id as id9_0_, this_.ano_id as ano2_9_0_, this_.regroup_ano_id as regroup3_9_0_, this_.commentaire as commenta4_9_0_, this_.date_heure as date5_9_0_, this_.destination_id as destinat6_9_0_, this_.emplacement_id as emplacem7_9_0_, this_.etiq_cont_id as etiq8_9_0_, this_.qte_cont as qte9_9_0_, this_.qte_dechet as qte10_9_0_, this_.regoup_comment as regoup11_9_0_, this_.regroup_date_heure as regroup12_9_0_, this_.operateur_id as operateur13_9_0_ from collecte this_ where this_.emplacement_id=? and this_.date_heure between ? and ?
2007-01-05 15:57:46,718 [DEBUG] org.hibernate.jdbc.AbstractBatcher:476 - preparing statement
2007-01-05 15:57:46,718 [DEBUG] org.hibernate.engine.IdentifierValue:104 - id unsaved-value: 0
2007-01-05 15:57:46,718 [DEBUG] org.hibernate.type.LongType:80 - binding '304' to parameter: 1
2007-01-05 15:57:46,718 [DEBUG] org.hibernate.type.TimestampType:80 - binding '2004-07-01 15:57:42' to parameter: 2
2007-01-05 15:57:46,718 [DEBUG] org.hibernate.type.TimestampType:80 - binding '2004-07-02 15:57:42' to parameter: 3
2007-01-05 15:57:46,718 [DEBUG] org.hibernate.jdbc.AbstractBatcher:374 - about to open ResultSet (open ResultSets: 0, globally: 0)
2007-01-05 15:57:46,718 [DEBUG] org.hibernate.loader.Loader:682 - processing result set
2007-01-05 15:57:46,718 [DEBUG] org.hibernate.loader.Loader:709 - done processing result set (0 rows)
2007-01-05 15:57:46,718 [DEBUG] org.hibernate.jdbc.AbstractBatcher:381 - about to close ResultSet (open ResultSets: 1, globally: 1)
2007-01-05 15:57:46,718 [DEBUG] org.hibernate.jdbc.AbstractBatcher:366 - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
2007-01-05 15:57:46,718 [DEBUG] org.hibernate.jdbc.AbstractBatcher:525 - closing statement
2007-01-05 15:57:46,718 [DEBUG] org.hibernate.loader.Loader:839 - total objects hydrated: 0
2007-01-05 15:57:46,718 [DEBUG] org.hibernate.engine.StatefulPersistenceContext:748 - initializing non-lazy collections
2007-01-05 15:57:46,718 [DEBUG] org.hibernate.jdbc.JDBCContext:233 - after autocommit
2007-01-05 15:57:46,718 [DEBUG] org.hibernate.jdbc.ConnectionManager:296 - transaction completed on session with on_close connection release mode; be sure to close the session to release JDBC resources!
2007-01-05 15:57:46,718 [DEBUG] org.hibernate.impl.SessionImpl:422 - after transaction completion
2007-01-05 15:57:46,718 [DEBUG] com.webtiss.sita.sgp.business.impl.SiteOperationBusiness:224 - doPrepareFilter - Emplacement id : 305
2007-01-05 15:57:46,718 [DEBUG] com.webtiss.sita.sgp.business.impl.SiteOperationBusiness:254 - 35
2007-01-05 15:57:46,718 [DEBUG] org.springframework.orm.hibernate3.SessionFactoryUtils:333 - Opening Hibernate Session
2007-01-05 15:57:46,718 [DEBUG] org.hibernate.impl.SessionImpl:220 - opened session at timestamp: 4784165137276928
2007-01-05 15:57:46,734 [DEBUG] com.webtiss.sita.sgp.dao.hibernate.CollecteDAOHibernate:70 - getAll CollecteDAOHibernate without op criteria
2007-01-05 15:57:46,734 [DEBUG] com.webtiss.sita.sgp.dao.hibernate.CollecteDAOHibernate:73 - after
2007-01-05 15:57:46,734 [DEBUG] org.hibernate.jdbc.AbstractBatcher:358 - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
2007-01-05 15:57:46,734 [DEBUG] org.hibernate.jdbc.ConnectionManager:415 - opening JDBC connection


voici le code de ma méthode au niveau DAO qui genere le criteria

[/code]
Code:
public List getAll(Emplacement e, Operateur op, Date heure_debut, Date heure_fin) throws InexbeeDAOException {
      Criteria criteria = super.getSession().createCriteria(Collecte.class);
      criteria.add(Restrictions.eq("emplacement",e));
      if(op != null) {
         LOG.debug("getAll CollecteDAOHibernate with op criteria");
         criteria.add(Restrictions.eq("utilisateur",op));
      }else {
         LOG.debug("getAll CollecteDAOHibernate without op criteria");
      }
      criteria.add(Restrictions.between("date_heure",heure_debut,heure_fin));
      LOG.debug("after");
      List list = (List)criteria.list();
      return list;
   }
[/quote]

si vous avez des idées n'hesitez pas !
merci


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 05, 2007 12:48 pm 
Newbie

Joined: Thu Nov 30, 2006 12:21 pm
Posts: 14
j'ai fixé le problème .
une explication détailler est fournie dans le forum en anglais.
thread : http://forum.hibernate.org/viewtopic.php?t=969312


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.