-->
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.  [ 6 posts ] 
Author Message
 Post subject: Help on first hibernate application
PostPosted: Fri Aug 08, 2008 5:31 am 
Newbie

Joined: Fri Aug 08, 2008 5:23 am
Posts: 3
hi,
i m the new user of hibernate and im getting an execption im using hibernate with myeclipse im using hibernate 3.1.

org.hibernate.hql.ast.QuerySyntaxException:table is not mapped


can u please tell me where im going wrong and if possible please suggest me a good tutorial for myeclipse and hibernate


thanks in advance


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 08, 2008 5:46 am 
Newbie

Joined: Wed Jul 30, 2008 7:48 am
Posts: 10
Location: NOIDA
some .hbm mentioned in your hibernate.cfg.xml is not valid.
Basicaly, There is three reasons behind it:-
1.May be you have same .hbm in two package. and you have metioned both .hbm file in hibernate.cfg.xml
2.In corresponding .hbm, check out your schema.
3. you have not metioned your mapping of table in hibernate.cfg.xml


Last edited by Manish Kumar on Fri Aug 08, 2008 5:51 am, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 08, 2008 5:47 am 
Newbie

Joined: Wed Jul 30, 2008 7:48 am
Posts: 10
Location: NOIDA
some .hbm mentioned in your hibernate.cfg.xml is not valid.
Basicaly, There is three reasons behind it:-
1.May be you have same .hbm in two package. and you have metioned both .hbm file in hibernate.cfg.xml
2.In corresponding .hbm, check out your schema.
3. you have not metioned your mapping of table in hibernate.cfg.xml


Top
 Profile  
 
 Post subject: hibernate application
PostPosted: Fri Aug 08, 2008 6:06 am 
Newbie

Joined: Fri Aug 08, 2008 5:23 am
Posts: 3
hi manish
thanks for your reply but manish im using myeclipse with hibernate and i have only one
.hbm files

im not creating any files my eclipse is generating all the files and im doin reverse engeneering on the table

thanks


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 08, 2008 6:20 am 
Newbie

Joined: Fri Aug 08, 2008 5:23 am
Posts: 3
hi manish
these are the files im using
so if u caqn figure out something from this

my configuration file

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<!-- Generated by MyEclipse Hibernate Tools. -->
<hibernate-configuration>

<session-factory>
<property name="connection.username">trainee</property>
<property name="connection.url">
jdbc:microsoft:sqlserver://192.168.1.252:1433
</property>
<property name="dialect">
org.hibernate.dialect.SQLServerDialect
</property>
<property name="myeclipse.connection.profile">MyDb</property>
<property name="connection.password">trainee</property>
<property name="connection.driver_class">
com.microsoft.jdbc.sqlserver.SQLServerDriver
</property>
<mapping resource="hibernatefiles/Products.hbm.xml" />

</session-factory>

</hibernate-configuration>


hbm.xml

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!--
Mapping file autogenerated by MyEclipse Persistence Tools
-->
<hibernate-mapping>
<class name="hibernatefiles.Products" table="products" schema="trainee" catalog="pubs">
<id name="pno" type="java.lang.Integer">
<column name="pno" />
<generator class="assigned" />
</id>
<property name="pname" type="java.lang.String">
<column name="pname" length="25" />
</property>
<property name="pcat" type="java.lang.String">
<column name="pcat" length="25" />
</property>
</class>
</hibernate-mapping>


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 14, 2008 3:08 am 
Newbie

Joined: Wed Jul 30, 2008 7:48 am
Posts: 10
Location: NOIDA
then in query try to use " from Products".. because (Products is your pojo and is correspondance Class of your table).. i think you are using " from products".. products is your table name.. that why you are getting the exception..
one more thing, add Products class in import( upper section of your Java Class).. otherwise use "from hibernatefiles.Products"


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