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: Bitwise operators in HQL (was: Custom ISQLFunction not used)
PostPosted: Fri Mar 02, 2007 6:28 am 
Newbie

Joined: Fri Jan 26, 2007 10:41 am
Posts: 4
Hibernate version:
1.2.0.3001

Name and version of the database you are using:
MySQL 5.0.15

I've made a custom Nhibernate Dialect which inherits the MySQLDialect, because I want support for bitwise operators (its similar to what the guy in this topic is doing: http://forum.hibernate.org/viewtopic.php?t=940978). I register the custom SQLFunction like this:

Code:
Me.RegisterFunction("BitWiseAnd", New MySQLBitwiseAndSQLFunction())


MySQLBitwiseAndSQLFunction is a class which implements ISQLFunction

When reading out the Functions (by using SessionFactory.Dialect.Functions.Values) I can see that my function is added. However, when I execute a query with my custom function in it, Nhibernate won't transform my function.

When executing the following (the BitWiseAnd doesn't do anything special at the moment, it only returns a fixed string in the Render method for testing):

Code:
Select BitWiseAnd(1) From NS.TestObject


No errors occur, but it seems that Nhibernate just trows the the BitWiseAnd(1) away.

In the following topic I've found that this isn't supported until CR1
http://forum.hibernate.org/viewtopic.php?t=970419, However I'm using the CR1 so this shouldn't be the problem.

Quote:
The function will be there in the CR1 release. It's possible that you can't add/override functions,


Can somebody please point me in the right direction?

Thanks in advance!


Last edited by richardversluis on Sat Mar 03, 2007 1:38 pm, edited 2 times in total.

Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 02, 2007 7:27 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
No, you can't add new functions, the parser is not designed to handle that.


Top
 Profile  
 
 Post subject: bitmask / bitwise operators
PostPosted: Fri Mar 02, 2007 8:15 am 
Newbie

Joined: Fri Jan 26, 2007 10:41 am
Posts: 4
Hi Sergey, thanx for your reply. So do you mean that the current version isn't ready for it yet (even CR1) ?

Is there any other solution to make bitwise operators work in NHibernate, beside using plain SQL? I'm working on this all day and I'm very desperate that I even would be very happy with the dirtiest workaround. ;)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 05, 2007 8:28 am 
Newbie

Joined: Fri Jan 26, 2007 10:41 am
Posts: 4
Any clues? What alternatives are there for avoiding bitmask values?


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.