-->
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.  [ 9 posts ] 
Author Message
 Post subject: hibernate tools - HQL scratchpad
PostPosted: Wed Feb 15, 2006 9:46 am 
Beginner
Beginner

Joined: Mon Oct 24, 2005 2:45 am
Posts: 23
Could any body help why my HQL scratchpad disabled in Hibernate tools.

I could see my object table in Hibernate Entity Model
and Relation Model


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 15, 2006 9:52 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
in the current version you need to create a session factory.

That is best done by right clicking and selecting "create session factory" or by expanding the tree.

After that hql scratchpad should be non-gray

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: hibernate tools - HQL execution
PostPosted: Wed Feb 15, 2006 11:34 am 
Beginner
Beginner

Joined: Mon Oct 24, 2005 2:45 am
Posts: 23
hi max,

Thanks for support

Now it was enabled but i get following error in Hibernate Dynamic Query Transalator

I am trying to execute HQL in scratchpad

from item
----------------------------------------------------------------------

org.hibernate.hql.ast.QuerySyntaxException: item is not mapped. [from item
]
Caused by:
org.hibernate.hql.ast.QuerySyntaxException: item is not mapped. [from item
]


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 15, 2006 11:44 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
yes....item is not mapped....wild guess, try with "from Item" instead

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: HQL execution with Hibernate Tools in eclipse
PostPosted: Thu Feb 16, 2006 1:30 am 
Beginner
Beginner

Joined: Mon Oct 24, 2005 2:45 am
Posts: 23
Max

tried as per your suggestion
i am getting below errors even i used complete path of my

Do i need to add any jar files in my application lib.
At present i have only

SQL Server Drivers
msbase.jar,mssqlserver.jar,msutil.jar
hsqldb.jar
hibernate-tools.jar
hibernate3.jar
--------------------------------------------------------------------


1) from com.edhand.example1.Item

error in Hibernate Dynamic Query Transalator

org.hibernate.QueryException: unexpected char: '"' ["from Item"

]
Caused by:
org.hibernate.QueryException: unexpected char: '"' ["from Item"

]

--------------------------------------
Config Files
-------------------
<?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">
<hibernate-configuration>
<session-factory name="HibernateSessionFactory">
<property name="hibernate.connection.driver_class">com.microsoft.jdbc.sqlserver.SQLServerDriver</property>
<property name="hibernate.connection.password">test</property>
<property name="hibernate.connection.url">jdbc:microsoft:sqlserver://raghuveer:1433;DatabaseName=test;SelectMethod=cursor</property>
<property name="hibernate.connection.username">test</property>
<property name="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</property>


<mapping resource="com/edhand/example1/Item.hbm.xml"/>
</session-factory>
</hibernate-configuration>
--------------------------------------
Mapping File
-------------

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping>
<class name="com.edhand.example1.Item" table="item" >
<id name="id" column="id" type="java.lang.Integer" unsaved-value="0">
<generator class="native">
<param name="native">item_id_seq</param>
</generator>

</id>
<property name="name" column="name" type="java.lang.String" />
<property name="description" column="description" type="java.lang.String" />
</class>
</hibernate-mapping>


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 16, 2006 4:06 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
dude ;) don't include the quotation marks in the query; they where there to show the start and end of the query.

Here it is again in "clean form":

Code:
from Item


ok ? :)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: HQL Query Output
PostPosted: Thu Feb 16, 2006 6:00 am 
Beginner
Beginner

Joined: Mon Oct 24, 2005 2:45 am
Posts: 23
Max,

Thanks!!

Now it was enabled after adding Classes in along with SQL server dtabase drivers.

I am trying to execute HQL in scratchpad

from Item

------------------------------------------------------
Hibernate Dynamic Query Transalator

SQL #0 types: com.edhand.example1.Item

select
item0_.id as id54_,
item0_.name as name54_,
item0_.description as descript3_54_
from
test.item item0_

--------------------------------------------

In hibernate Query Result
I find Column heading as "com.edhand.example1.Item"
i dont find any data in GRID.

BUt i have number of records in my database table and could access from hibernate and struts in web application
-----------------------------------

Can I see my SQL server Database table data in this editor.
Does this possiable with theses tools ?.

If YES hibernate tools would helpfull for me as i am beginner.

if NO how can i use these each



AFter HQL execution i dont find any out put in
Hibernate Query Result
Query Parameters

I am refering following for integrating these toos for my eclipse.
http://www.hibernate.org/hib_docs/tools ... gle/#d0e28


Max,please support me to see some object data in Hibernate Query Result


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 16, 2006 7:38 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
it should work if the mapping is correct yes.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 16, 2006 11:44 am 
Beginner
Beginner

Joined: Mon Oct 24, 2005 2:45 am
Posts: 23
max wrote:
it should work if the mapping is correct yes.


thanks max.


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