-->
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: Hibern8IDE cannot execute query
PostPosted: Fri Mar 12, 2004 5:58 am 
Newbie

Joined: Thu Feb 12, 2004 10:02 am
Posts: 10
Location: Ghent, Belgium
I'm trying to get Hibern8IDE to work, but it fails. I only have a hibernate.cfg.xml file, not a properties file.

In the tree on the left, I see the classes I have mapped, so my mapping files are located.

When I try to execute a query, I get an SQLException stating the table I'm using doesn't exist (I'm using the jtds driver with MS SQL server 2000). When I execute the same query from my program, everything works, so there is no problem with my mapping file and my config file (I think).

config file:
Code:
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
        "-//Hibernate/Hibernate Configuration DTD 2.0//EN"

"http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">

<hibernate-configuration>

    <!-- a SessionFactory instance listed as /jndi/name -->
    <session-factory>

        <!-- properties -->       
        <property name="connection.username">swp</property>
        <property name="connection.password">swp</property>
        <property name="connection.url">jdbc:jtds:sqlserver://swp_ds001:1433/persistencetest</property>
        <property name="connection.driver_class">net.sourceforge.jtds.jdbc.Driver</property>
        <property name="dialect">net.sf.hibernate.dialect.SQLServerDialect</property>
        <property name="show_sql">true</property>
        <property name="use_outer_join">true</property>

        <!-- mapping files -->
        <mapping resource="hibernate/model/UserGroup.hbm.xml"/>
        <mapping resource="hibernate/model/User.hbm.xml"/>
        <mapping resource="hibernate/model/AccessLevel.hbm.xml"/>
        <mapping resource="hibernate/model/order/Order.hbm.xml"/>
        <mapping resource="hibernate/model/order/OrderLine.hbm.xml"/>
    </session-factory>

</hibernate-configuration>


Mapping files:
Code:
<?xml version="1.0"?>

<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping>
    <class
        name="model.User"
        table="Users"
        dynamic-update="false"
        dynamic-insert="false"
    >

        <id
            name="id"
            column="id"
            type="java.lang.Integer"
        >
            <generator class="increment">
            </generator>
        </id>

        <property
            name="code"
            type="java.lang.String"
            update="true"
            insert="true"
            column="code"
        />

        <component
            name="name"
            class="model.Name"
        >

        </component>

        <many-to-one
            name="userGroup"
            class="model.UserGroup"
            cascade="none"
            outer-join="auto"
            update="true"
            insert="true"
            column="userGroupID"
        />

        <!--
            To add non XDoclet property mappings, create a file named
                hibernate-properties-User.xml
            containing the additional properties and place it in your merge dir.
        -->

    </class>

</hibernate-mapping>


Code:
<?xml version="1.0"?>

<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping>
    <class
        name="model.UserGroup"
        table="UserGroup"
        dynamic-update="false"
        dynamic-insert="false"
        lazy="true"
    >

        <id
            name="id"
            column="id"
            type="java.lang.String"
        >
            <generator class="increment">
            </generator>
        </id>

        <property
            name="description"
            type="java.lang.String"
            update="true"
            insert="true"
            column="description"
        />

        <!--
            To add non XDoclet property mappings, create a file named
                hibernate-properties-UserGroup.xml
            containing the additional properties and place it in your merge dir.
        -->

    </class>

</hibernate-mapping>


The tables Users and UserGroup are present in my database.

Any ideas?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 12, 2004 10:14 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
enable and look in hibernate log output and see what it actually connects to ... and see if it what you expect ;)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 12, 2004 10:41 am 
Newbie

Joined: Thu Feb 12, 2004 10:02 am
Posts: 10
Location: Ghent, Belgium
So stupid....

Turns out I'm trying to run my query on the wrong database after all.

I'll shut up now :-)

How could I ever questioned the working of the tool ;-)


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.