-->
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: How do I get rid of the subscrip0_ prefixes in my query?
PostPosted: Mon Dec 01, 2003 10:59 am 
Beginner
Beginner

Joined: Wed Nov 26, 2003 11:53 am
Posts: 26
Location: Netherlands
(Using MySQL)

The query builder prefixes all my fields with all these subscrip thingies. My guess is that these are placeholders for the schema. I guess that I could use the hibernate.default_schema property set to the schema name, but I don't want to do that, I want a clean query and keep the name of the schema restricted to the database URL.

Or maybe there is something else wrong here?

2003-12-01 15:22:22,246 DEBUG [net.sf.hibernate.hql.QueryTranslator] HQL: from nl.sogeti.piloot.server.admin.model.Subscription as subs where subs.number = ?
2003-12-01 15:22:22,246 DEBUG [net.sf.hibernate.hql.QueryTranslator] SQL: select subscrip0_.id as id, subscrip0_.version as version, subscrip0_.number as number, subscrip0_.address as address, subscrip0_.city as city, subscrip0_.endDate as endDate, subscrip0_.name as name, subscrip0_.standalone as standalone, subscrip0_.startDate as startDate, subscrip0_.zipCode as zipCode, subscrip0_.numberOfIButtons as numberO11_, subscrip0_.lastversion as lastver12_, subscrip0_.description as descrip13_ from Subscription subscrip0_ where (subscrip0_.number=? )
2003-12-01 15:22:22,246 DEBUG [net.sf.hibernate.impl.BatcherImpl] about to open: 0 open PreparedStatements, 0 open ResultSets
2003-12-01 15:22:22,256 DEBUG [net.sf.hibernate.impl.SessionFactoryImpl] prepared statement get: select subscrip0_.id as id, subscrip0_.version as version, subscrip0_.number as number, subscrip0_.address as address, subscrip0_.city as city, subscrip0_.endDate as endDate, subscrip0_.name as name, subscrip0_.standalone as standalone, subscrip0_.startDate as startDate, subscrip0_.zipCode as zipCode, subscrip0_.numberOfIButtons as numberO11_, subscrip0_.lastversion as lastver12_, subscrip0_.description as descrip13_ from Subscription subscrip0_ where (subscrip0_.number=? )
2003-12-01 15:22:22,256 INFO [STDOUT] Hibernate: select subscrip0_.id as id, subscrip0_.version as version, subscrip0_.number as number, subscrip0_.address as address, subscrip0_.city as city, subscrip0_.endDate as endDate, subscrip0_.name as name, subscrip0_.standalone as standalone, subscrip0_.startDate as startDate, subscrip0_.zipCode as zipCode, subscrip0_.numberOfIButtons as numberO11_, subscrip0_.lastversion as lastver12_, subscrip0_.description as descrip13_ from Subscription subscrip0_ where (subscrip0_.number=? )
2003-12-01 15:22:22,256 DEBUG [net.sf.hibernate.impl.SessionFactoryImpl] preparing statement
2003-12-01 15:22:22,256 DEBUG [net.sf.hibernate.type.LongType] binding '9478776' to parameter: 1
2003-12-01 15:22:22,256 DEBUG [net.sf.hibernate.loader.Loader] processing result set
2003-12-01 15:22:22,256 DEBUG [net.sf.hibernate.loader.Loader] done processing result set (0 rows)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 01, 2003 11:12 am 
Beginner
Beginner

Joined: Wed Nov 26, 2003 11:53 am
Posts: 26
Location: Netherlands
BTW: I tried setting hibernate.default_schema: it didn't help. There are still subscrip's all over the query


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 01, 2003 11:16 am 
Beginner
Beginner

Joined: Wed Nov 26, 2003 11:53 am
Posts: 26
Location: Netherlands
... and for the record, here are the queries when the default schema is "piloot"

16:10:09,764 INFO [STDOUT] Hibernate: select subscrip0_.id as id, subscrip0_.version as version, subscrip0_.number as number, subscrip0_.address as address, subscrip0_.city as city, subscrip0_.endDate as endDate, subscrip0_.name as name, subscrip0_.standalone as standalone, subscrip0_.startDate as startDate, subscrip0_.zipCode as zipCode, subscrip0_.numberOfIButtons as numberO11_, subscrip0_.lastversion as lastver12_, subscrip0_.description as descrip13_ from piloot.Subscription subscrip0_ where (subscrip0_.number=? )
16:10:09,774 INFO [STDOUT] Hibernate: insert into piloot.Subscription (version, number, address, city, endDate, name, standalone, startDate, zipCode, numberOfIButtons, lastversion, description) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 01, 2003 11:23 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
thoses are aliases. This is basic SQL usage

select alias.id from MyTable alias.

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 02, 2003 5:21 am 
Beginner
Beginner

Joined: Wed Nov 26, 2003 11:53 am
Posts: 26
Location: Netherlands
Argh, of course. The subscription table was aliased as subscrip0_.

Sigh. Me idiot, sorry!


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.