-->
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: Inner Join
PostPosted: Wed Feb 06, 2008 4:36 pm 
Newbie

Joined: Wed Feb 06, 2008 3:43 pm
Posts: 5
Je suis un débutant Hibernate, et j'aimerais avoir l'aide de quelqu'un puisque j'ai quelque peu de difficulté à changer de JDBC a hibernate. Voici mon probleme:

J'ai un select du genre qui est généré dynamiquement, le nombre de table peu donc varier, à transferrer en hibernare

SELECT
ligne.report_fact_id AS report_fact_id,
ligne.place AS PLACE,
ligne.fact_id AS FACT,
ligne.comments AS COMMENTS,
ligne.applicable AS APPLICABLE ,
col1.column_usage AS COLST1 ,
col1.string_value AS COL1 ,
col2.column_usage AS COLST2 ,
col2.string_value AS COL2 ,
col3.column_usage AS COLST3 ,
col3.date_value as col3
FROM ip.ligne pfurepdet
INNER JOIN ip.cellule col1 ON (col1.detail_fact_id = ligne.fact_id)
INNER JOIN ip.cellule col2 ON (col2.detail_fact_id = ligne.fact_id)
INNER JOIN ip.cellule col3 ON (col3.detail_fact_id = ligne.fact_id)
WHERE report_fact_id = 34242
col1.pfd_col_fact_id = 1 AND
col2.pfd_col_fact_id = 2 AND
col3.pfd_col_fact_id = 3 AND
ORDER BY ligne.place

Si j'utilise un méthode du genre pour excuter mes requêtes comment je fait pour itérer dans ma list puisque je ne peut ma caster un type en particulier puisque ma liste contient différent type et comment je fait la différence entre mes différente table ligne.

private static void exuteQuery(String query) {
Transaction tx = null;
Session session = InitSessionFactory.getInstance().getCurrentSession();

try {
tx = session.beginTransaction();
List list = session.createQuery(query).list();

for (Iterator iter = list .iterator(); iter.hasNext();) {

//MaClasse element = (MaClasse ) iter.next();

log.debug(element);
}

tx.commit();
} catch (HibernateException e) {
e.printStackTrace();
if (tx != null && tx.isActive())
tx.rollback();

}
}

Merci


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.