-->
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 de requete hibernate
PostPosted: Tue Aug 17, 2010 5:12 pm 
Newbie

Joined: Tue Aug 17, 2010 5:05 pm
Posts: 2
bonjour

Je n'arrive pas à resoudre des probleme de requete

Je veux faire :
String sql = "from membre";
Query q = cx.getConnection().createQuery(sql);
List l = q.list();

J'ai essayé avec find et iterate aussi mais peine perdu.

Mon erreur est que could'not execute query ou erreur de syntaxe apres from

Je fais d'autre requete d'însertion de update ca fonction bien
Deja mon query fait des erreurs quand je fait query.execute()

Merci de me repondre


Top
 Profile  
 
 Post subject: Re: Probleme de requete hibernate
PostPosted: Thu Aug 19, 2010 2:28 am 
Newbie

Joined: Tue Oct 27, 2009 10:37 am
Posts: 6
Location: France
Bonjour,

Un exemple de code tiré de la documentation (section 1.1.7 http://docs.jboss.org/hibernate/stable/ ... ersistence)

Code:
public List listEvents() {

        Session session = HibernateUtil.getSessionFactory().getCurrentSession();
        session.beginTransaction();
        List result = session.createQuery("from Event").list();
        session.getTransaction().commit();

        return result;
}

_________________
http://jnesis.com


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.