-->
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.  [ 4 posts ] 
Author Message
 Post subject: UserType Error in a Criteria
PostPosted: Thu Jan 14, 2010 6:06 pm 
Newbie

Joined: Thu Jan 14, 2010 5:14 pm
Posts: 3
I need to add an "in" restricction with more than 1000 keys ( ... add(Restrictions.not(Restrictions.in("keys", list))) ... I need to send all keys at same time) , I added a new type to the data base and a new user type, and it works very fine with a Query and native SQL, but I need to use Criteria. I tried to created my own Criterion and work with the userType, but I don't know how I can do that. a SQLException is shooted, if somebody need some of my code I can posted it here. Please, let me know your comments.

Best Regards,
Cesar Diaz


Top
 Profile  
 
 Post subject: Re: UserType Error in a Criteria
PostPosted: Fri Jan 15, 2010 6:50 pm 
Beginner
Beginner

Joined: Wed Jan 07, 2009 7:07 pm
Posts: 26
As far as I know Oracle support maximum of 1000 values in the static in clause.

What DB are you using ? Can you post the exception that you are getting ?


Top
 Profile  
 
 Post subject: Re: UserType Error in a Criteria
PostPosted: Mon Jan 18, 2010 3:23 pm 
Newbie

Joined: Thu Jan 14, 2010 5:14 pm
Posts: 3
gaur wrote:
As far as I know Oracle support maximum of 1000 values in the static in clause.

What DB are you using ? Can you post the exception that you are getting ?


I'm working over Oracle 10g, and it's can execute with a lot of keys, I tested it, the restriction is in Hibernate.

I can add more than 1000 keys with a query:
sql = "select * from employees where employee_key in (select * from table(cast(:parameterName as NUMBERTABLE)))"

list = getSession().createSQLQuery(sql)
.setParameter("parameterName", keys, Hibernate.custom(NumberTableType.class))
.list()

* public class NumberTableType implements UserType, LiteralType{ ...
* NUMBERTABLE is a new Type into Data Base (Oracle)

But, I need to implement something like that with Criteria :(

Thanks ...


Top
 Profile  
 
 Post subject: Re: UserType Error in a Criteria
PostPosted: Mon Jan 18, 2010 3:32 pm 
Newbie

Joined: Thu Jan 14, 2010 5:14 pm
Posts: 3
:( Well, you alright, The exception is : ORA-01795: maximum number of expressions in a list is 1000

But, It's working like I wrote in my last post.


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