-->
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: Where do i reference to my table in hibernate?
PostPosted: Fri Sep 29, 2006 8:27 pm 
Beginner
Beginner

Joined: Mon Sep 18, 2006 5:33 am
Posts: 25
Hi.

In hibernate where do i reference to my table, is it just in the *.hbm.xml files? cause im guessing from my error that hibernate doesnt know my table or something?
Note im using hibernate 2 in spring and i followed the spring in action book.

Code:
org.springframework.jdbc.BadSqlGrammarException: Hibernate operation: Could not save object; bad SQL grammar []; nested exception is java.sql.SQLException: Table not found in statement [select next_hi from hibernate_unique_key for update]   


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 29, 2006 11:06 pm 
Newbie

Joined: Thu Sep 28, 2006 12:27 pm
Posts: 13
Did you by any chance pick "hilo" as generator for your primary key and forgot to add the corresponding table and name properties?

The table- & column names in your errormessage look like the default values for that generator as stated in 5.1.4.1 in the official documentation.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Sep 30, 2006 3:17 am 
Beginner
Beginner

Joined: Mon Sep 18, 2006 5:33 am
Posts: 25
Im using identity for my generator class

any ideas?

Code:
<hibernate-mapping>
   <class name="src.bus.Photo" table="Photo">
      <id name="id" column="id" type="java.lang.Integer"
         unsaved-value="-1">
         [b]<generator class="identity"></generator>[/b]
      </id>
      <property name="location" column="location" type="string" />
      <property name="photographer" column="photographer"
         type="string" />
      <property name="datetaken" column="datetaken" type="string" />
      <property name="description" column="description" type="string" />
   </class>
</hibernate-mapping>


also do you need to specify the primary key in this mapping file?


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.