-->
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: (HN3) Example.createCriteria not working with one to many
PostPosted: Fri Jun 17, 2005 1:44 pm 
Newbie

Joined: Thu Jun 16, 2005 8:01 pm
Posts: 14
Hi .

Having a problem with createCriteria.

My Hibernate connection and sessions are ok. The only problem is hat I cannot use Example.createCriteria and get an error that: could not execute query.

I have also tried to type the SQL code between quotes and results in the same error.

Any help will be appreciated.

This is my little java code:
Code:
      System.out.println("Debug: Login starting (username: "+username.toString()+"; password: " + password.toString() + ")");
      User criteria = new User();
      criteria.setUserName(username.toString());
      criteria.setUserPassword(password.toString());

      System.out.println("Debug: Username in object: " + criteria.getUserName());
            
      System.out.println("Debug: HIBERNATE: Open session");
      Session session = sessions.openSession();
      
      System.out.println("Debug: HIBERNATE: Begin transaction");
      Transaction tx = session.beginTransaction();

      System.out.println("Debug: HIBERNATE: Craeting criteria");
      Criteria crit = session.createCriteria(User.class);

      System.out.println("Debug: HIBERNATE: Creating SQL code");
      List result = crit.add( Example.create(criteria)).list();

      session.close();
      
      System.out.println("Debug: Results: " + result.size());
//      tx.commit();
      return result;


The error:
Code:
Hibernate: select this_.user_id as user1_0_, this_.user_name as user2_0_0_, this_.user_password as user3_0_0_, this_.user_group_id as user4_0_0_ from user this_ where (this_.user_name=? and this_.user_password=?)
17-jun-2005 19:44:28 org.hibernate.util.JDBCExceptionReporter logExceptions
WARNING: SQL Error: 335544569, SQLState: HY000
17-jun-2005 19:44:28 org.hibernate.util.JDBCExceptionReporter logExceptions
SEVERE: GDS Exception. 335544569. Dynamic SQL Error
SQL error code = -104
Token unknown - line 1, char 140
user
17-jun-2005 19:44:28 org.hibernate.util.JDBCExceptionReporter logExceptions
WARNING: SQL Error: 335544569, SQLState: HY000
17-jun-2005 19:44:28 org.hibernate.util.JDBCExceptionReporter logExceptions
SEVERE: GDS Exception. 335544569. Dynamic SQL Error
SQL error code = -104
Token unknown - line 1, char 140
user
Exception in thread "AWT-EventQueue-0" org.hibernate.exception.GenericJDBCException: could not execute query

....


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 22, 2005 3:19 pm 
Newbie

Joined: Thu Jun 16, 2005 8:01 pm
Posts: 14
Solution: Use MySQL 4 :D


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.