-->
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: Constants, paging and null values
PostPosted: Tue May 17, 2005 8:33 am 
Newbie

Joined: Tue May 17, 2005 8:09 am
Posts: 5
Hi,

I'm using hibernate 3.0.3 against an Oracle9i database, and have a few problems/questions.

1) Is there any way to set a constant instead of a bind variable in a query? For example, I'm currently having to write:
Code:
"FROM t1 a WHERE a.status=" + Constants.TWO;

And so this is not able to be seperated out into the configuration file as a named query. The data in the table is going to be very skewed so the literal values will significantly help in the generated execution plan.


2) I have another query where I need to acquire results with a null value, so the query would look like this:
Code:
Query query = session.createQuery("FROM t1 a WHERE a.status=:status");
query.setString("status", null);


However, the generated SQL still has the "=null" in it, but Oracle requires it to be read as "IS NULL". Is there any way to set hibernate to translate that to "IS NULL", but leave as "=?" if for a non-null value, or will I have to interrogate the value and use a different query if null or not?


3) Although not an issue for the current project I'm working on, I have a question regarding the pagination. The setFirstResult method takes an int value as a parameter thereby limiting the allowable size for the table. The last project I worked on had several billion rows in one of the tables (and would grow) and required pagination. The primary keys were long values. If this were to be implemented in hibernate would I have had to have each query handle its own pagination (and therefore the database abstraction would be lost)?

Thanks for your time!
Andy


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.