-->
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: Newbie help on Spring-Hibernate implementation
PostPosted: Thu Jan 27, 2005 1:19 pm 
Newbie

Joined: Thu Jan 27, 2005 11:39 am
Posts: 4
I am using Spring and Hibernate together and appear to be running into a mapping issue when I try to do a simple find. I can run the native sql that is generated by hibernate in a command window and it executes fine. I would appreciate some troubleshooting tips along with any assisstance. I believe that I have all logging turned to debug, but still didn't get much in the way of messages.

Hibernate version: 2.1.7

Mapping documents:

<hibernate-mapping package="com.aholdusa.ltw">
<class name="License" table="license">
<id name="id" unsaved-value="null" column="ID">
<generator class="native" />
</id>
<property name="licenseId" type="string" column="LICENSE_ID" />
<property name="initialStartDate" type="long" column="INITIAL_START_DATE" />
<property name="startDate" type="long" column="START_DATE" />
<property name="endDate" type="long" column="END_DATE" />
<property name="cost" type="float" column="COST" />
<many-to-one name="type" foreign-key="FK_license_type" column="TYPE" class="LicenseType" />
<many-to-one name="contact" foreign-key="FK_license_contact" column="CONTACT" class="Contact" />
<many-to-one name="software" foreign-key="FK_license_software" column="SOFTWARE" class="Software" />
</class>
</hibernate-mapping>



<hibernate-mapping package="com.aholdusa.ltw">
<class name="LicenseType" table="license_type">
<id name="id" unsaved-value="null" column="ID">
<generator class="native" />
</id>
<property name="type" type="string" column="TYPE" />
</class>
</hibernate-mapping>

<hibernate-mapping package="com.aholdusa.ltw">
<class name="Contact" table="contact">
<id name="id" unsaved-value="null" column="ID">
<generator class="native" />
</id>
<property name="name" type="string" column="NAME" />
<list name="phone" table="contact_phone_list" outer-join="false">
<key column="CONTACT" />
<index column="ID" type="integer" />
<element column="PHONE_NUMBER" type="string" />
</list>
</class>
</hibernate-mapping>

<hibernate-mapping package="com.aholdusa.ltw" >
<class name="Vendor" table="vendor" >
<id name="id" unsaved-value="null" column="ID" >
<generator class="native"/>
</id>
<property name="name" type="string" column="NAME" />
<property name="vendorno" type="string" column="VENDOR_NUM" />
<many-to-one name="contact" foreign-key="FK_vendor_contact" column="CONTACT" class="Contact" />
</class>
</hibernate-mapping>



Code between sessionFactory.openSession() and session.close()::

I got this from the Spring handbook

Code:
Session session = SessionFactoryUtils.getSession(getSessionFactory(), false);
   try
   {
      List result = session.find("from com.aholdusa.ltw.License");
         
      if (result == null)
      {
         throw new LTWException("invalid search result");
      }
      return result;
      }
      catch (HibernateException ex)
      {
         throw SessionFactoryUtils.convertHibernateAccessException(ex);
      }

Full stack trace of any exception that occurs:

[1/27/05 11:23:18:513 EST] 786a7a4e JDBCException W net.sf.hibernate.util.JDBCExceptionReporter SQL Error: 0, SQLState: null
[1/27/05 11:23:18:523 EST] 786a7a4e JDBCException E net.sf.hibernate.util.JDBCExceptionReporter Parameter with index of 1 is not set.
[1/27/05 11:23:18:543 EST] 786a7a4e JDBCException W net.sf.hibernate.util.JDBCExceptionReporter SQL Error: 0, SQLState: null
[1/27/05 11:23:18:553 EST] 786a7a4e JDBCException E net.sf.hibernate.util.JDBCExceptionReporter Parameter with index of 1 is not set.


Name and version of the database you are using:

MySql 4.1

The generated SQL (show_sql=true):

Hibernate: select license0_.ID as ID, license0_.LICENSE_ID as LICENSE_ID, license0_.INITIAL_START_DATE as INITIAL_3_, license0_.START_DATE as START_DATE, license0_.END_DATE as END_DATE, license0_.COST as COST, license0_.TYPE as TYPE, license0_.CONTACT as CONTACT, license0_.SOFTWARE as SOFTWARE from license license0_

Debug level Hibernate log excerpt: ?????


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.