-->
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.  [ 5 posts ] 
Author Message
 Post subject: Problem with createSQLQuery (HIbernate bug???)
PostPosted: Tue Nov 30, 2004 11:04 am 
Newbie

Joined: Sat Sep 25, 2004 12:03 pm
Posts: 5
Hi
Problem was reproduce with 2.0.3 and 2.1.7

Im doing a SQL Query but hibernate seems to use the wrong table mapping,

My code looks like:

String sql = "select {componentlogs.*} from logs {componentlogs} where rowid in(select rid " +
"from (select rowid rid, rownum rnum from (" +
"SELECT rowid rid FROM logs where componentno = " + componentno + " " +
buildFilter() + " order by " + orderBy +
")) where rnum >= :from and rnum < :to)";

Query query = session.createSQLQuery(sql,"componentlogs", Logs.class);

query.setLong("from", itemFrom);
query.setLong("to", itemTo);

return query.list();

I receive a SQLException ORA-00904: "MODIFICATIONDATE": invalid identifier but there is not MODIFICATIONDATE column in the Logs table mapping... What is hibernate using to map the mapping and the query,, is it using the Logs.class?

Maybe its a Hibernate bug, i've been using hibernate for the last 6 months and its the first time i have something strange like that...

Thanks

Richard


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 30, 2004 11:23 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Impossible to tell without your mappings. Please think about what people need to solve your problems before you post.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 30, 2004 11:34 am 
Newbie

Joined: Sat Sep 25, 2004 12:03 pm
Posts: 5
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >

<hibernate-mapping auto-import="false">

<class
name="com.recruitsoft.rcc.persistence.hibernate.Logs"
table="LOGS"
>
<id
name="logno"
type="java.lang.Long"
column="LOGNO"
unsaved-value="null"
>
<generator class="net.sf.hibernate.id.SequenceGenerator">
<param name="sequence">LOGS_SEQ</param>
</generator>
</id>

<property
name="filename"
type="java.lang.String"
column="FILENAME"
not-null="true"
length="100"
/>
<property
name="logdate"
type="long"
column="LOGDATE"
not-null="true"
length="22"
/>

<!-- associations -->
<!-- bi-directional many-to-one association to Task -->
<many-to-one
name="component"
class="com.recruitsoft.rcc.persistence.hibernate.Component"
not-null="true"
>
<column name="COMPONENTNO" />
</many-to-one>

</class>
</hibernate-mapping>


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 30, 2004 11:37 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
I hardly believe this is the actual mapping used. Check that you don't have an old mapping file hanging around somewhere, and check the generated SQL, too.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 30, 2004 11:45 am 
Newbie

Joined: Sat Sep 25, 2004 12:03 pm
Posts: 5
Holy sh!t, forget about that, its 100% my fault... The problem was with the order column, i found it when checking for the SQL, sorry about that...

Thanks

Richard


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