-->
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.  [ 3 posts ] 
Author Message
 Post subject: could not execute query
PostPosted: Sun Mar 26, 2006 10:33 am 
Newbie

Joined: Tue Sep 06, 2005 11:11 am
Posts: 11
Location: Germany
Hallo,

beim Versuch eine MySQL-Tabelle auszulesen bekomme ich eine "could not execute query" Exception. Die Exception wird nur erzeugt, wenn die beiden "timestamp-Felder" im Mapping-File eingetragen sind. Ohne diese Felder ist alles OK.
Das Einfügen eines Datensatzes mit "session.save" funktioniert problemlos, AUCH MIT DEN BEIDEN TIMESTAMPS!. Damit kann das Problem nicht am Mapping-File liegen, oder?



Hibernate version:
hibernate3
Mapping documents:
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
        "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
        "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping>

        <class name="de.test.reminder.src.ReminderVO" table="REMINDER.EVENTS">
                <id name="id" column="id" type="long">
                        <generator class="increment"/>
                </id>
                <property name="name"/>
                <property name="beschreibung"/>
                <property name="datum"/>
                <property name="zeit"/>
                <property name="time"/>
                <property name="type"/>
                <property name="cyclBegin" column="cycl_begin" type="timestamp"/>
                <property name="cyclEnde" column="cycl_ende" type="timestamp"/>


        </class>

</hibernate-mapping>

Code between sessionFactory.openSession() and session.close():
Code:
    private List listData() {
        try {
            Session session = HibernateUtil.currentSession();
            Transaction tx = session.beginTransaction();
           
            List result = session.createQuery("from ReminderVO").list();
           
            tx.commit();
            HibernateUtil.closeSession();
           
            return result;
        } catch (HibernateException e) {
            throw new RuntimeException(e.getMessage());
        }
    }



Full stack trace of any exception that occurs:
Code:
Hibernate: select remindervo0_.id as id, remindervo0_.name as name0_, remindervo0_.beschreibung as beschrei3_0_, remindervo0_.datum as datum0_, remindervo0_.zeit as zeit0_, remindervo0_.time as time0_, remindervo0_.type as type0_, remindervo0_.cycl_begin as cycl8_0_, remindervo0_.cycl_ende as cycl9_0_ from REMINDER.EVENTS remindervo0_
Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException: could not execute query

Name and version of the database you are using:
MySQL4.1
The generated SQL (show_sql=true):
Code:
select remindervo0_.id as id, remindervo0_.name as name0_, remindervo0_.beschreibung as beschrei3_0_, remindervo0_.datum as datum0_, remindervo0_.zeit as zeit0_, remindervo0_.time as time0_, remindervo0_.type as type0_, remindervo0_.cycl_begin as cycl8_0_, remindervo0_.cycl_ende as cycl9_0_ from REMINDER.EVENTS remindervo0_


Vielen Dank
Richard

BTW: Die generierte Query direkt in den "MySQL Query Browser" gepastet funktioniert problemlos!!


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 31, 2006 10:37 am 
Pro
Pro

Joined: Mon Jan 24, 2005 5:39 am
Posts: 216
Location: Germany
Hallo,

normalerweise enthält die Exception noch den cause:

ex.getCause();

dieser dürfte in deinem Fall die verursachende SQLException
sein. Vermutlich wird in eurem Anwendungscode die Exception
gefangen und nur ex.getMessage() ausgegeben.

_________________
dont forget to rate !


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 02, 2006 3:24 am 
Newbie

Joined: Tue Sep 06, 2005 11:11 am
Posts: 11
Location: Germany
Hi steckemetz,

danke, stimmt genau, es nur wird "getMessage()" ausgegeben. Auf einen ersten Blick habe ich jetzt gesehen, das es wohl an einem oder mehreren Datesätzen liegt. Es gibt da ein Problem mit einem Timestamp. Mal sehen was getCause() ausgibt.

Erst mal Danke

Richard


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