-->
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: Hazarath
PostPosted: Fri Oct 30, 2009 5:10 am 
Newbie

Joined: Fri Oct 30, 2009 5:03 am
Posts: 1
Hi any body helpme i got this problem

SEVERE: could not read a hi value - you need to populate the table: category_pk
Exception in thread "main" org.hibernate.id.IdentifierGenerationException: could
not read a hi value - you need to populate the table: category_pk

here is the code

<hibernate-mapping>
<class name="Category" table="Category">
<id name="cid" column="cid">
<generator class="hilo">
<param name="table">category_pk</param>
<param name="column">cid</param>
<param name="max lo">100</param>
</generator>
</id>
<property name="cname" column="cname"/>
<property name="cdescr" column="cdescr"/>
</class>
</hibernate-mapping>



<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>
<session-factory >
<property name="connection.driver_class">sun.jdbc.odbc.JdbcOdbcDriver</property>
<property name="connection.url">jdbc:odbc:ShigaInfo</property>
<property name="connection.username">system</property>
<property name="connection.password">manager</property>
<property name="show_sql">true</property>
<property name="hibernate.dialect">org.hibernate.dialect.OracleDialect</property>
<mapping resource="Category.hbm.xml"/>

</session-factory>
</hibernate-configuration>



import org.hibernate.*;
import org.hibernate.cfg.*;

public class Client{

public static void main(String rags[]){

Configuration c=new Configuration();
c.configure("/hibernate.cfg.xml");
SessionFactory sf=c.buildSessionFactory();
Session s=sf.openSession();
Transaction tx=s.beginTransaction();
Category c1=new Category();
c1.setCid(1);
c1.setCname("books");
c1.setCdescr("Books for good Health & wealth");
s.save(c1);
s.flush();
tx.commit();
s.close();
}

}


regards

hazarath


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.