-->
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.  [ 7 posts ] 
Author Message
 Post subject: Custom Dialect Was working with Hibernate 3.5 but not in 3.6
PostPosted: Sat Jan 22, 2011 4:27 pm 
Newbie

Joined: Sat Jan 22, 2011 3:52 pm
Posts: 3
Hi
I had created a Dialect so that i can add one method bitwiseAnd() . Was working Good in 3.5.
When I switched to 3.6 It was Depericated Type Hibernate.BIG_INTEGER was used in the function creation
So I changed It to StandardBasicTypes.BIG_INTEGER.

But now I am getting Exception that <databaseName>.bitwiseAnd() function not found!
----
If Switch back to 3.5 and with Depricated Hibernate.BIG_INTEGER it works fine.
-----------------------------------
But I am unable to Undersatnd Why It is not Working In 3.6
---------------------------------------------------------------
Here is My Two classes creating the Dialect With Function bitWiseAnd()
Code:
import org.hibernate.type.StandardBasicTypes;

public class BitWiseAndDialect extends org.hibernate.dialect.MySQLDialect{
   
   
   public BitWiseAndDialect() {
      super();
      
      registerFunction("bitwiseAnd", new BitwiseAndFunction("bitwiseAnd",StandardBasicTypes.BIG_INTEGER));
   }

}
//AND
import org.hibernate.QueryException;
import org.hibernate.dialect.function.SQLFunction;
import org.hibernate.dialect.function.StandardSQLFunction;
import org.hibernate.engine.SessionFactoryImplementor;
import org.hibernate.type.Type;
public class BitwiseAndFunction extends StandardSQLFunction implements SQLFunction {

public BitwiseAndFunction(String name)
{
        super(name);
}

public BitwiseAndFunction(String name, Type type) {
    super(name, type);
}

public String render(List args,SessionFactoryImplementor factory)throws QueryException
{
   // The code to render the function
}


}




And As i have mentioned it was working (IF I USE Hibernate_BIG_INTEGER with 3.5) so Configuration has no problem.
But is not working with 3.6.


Top
 Profile  
 
 Post subject: Re: Custom Dialect Was working with Hibernate 3.5 but not in 3.6
PostPosted: Thu Jan 27, 2011 8:49 am 
Newbie

Joined: Thu Jun 16, 2005 7:00 am
Posts: 6
Hi,

did you find a solution to you problem? I'm also facing the exact same problem, only difference is that I had Hibernate.INTEGER before, and changed it to StandardBasicTypes.INTEGER.

Btw, the error with Hibernate.INTEGER was discovered during deployment to JBoss 6.0.0.Final.

After changing to StandardBasicTypes.INTEGER it deploys ok, but when I do a query which involves my custom Dialect I get:
20:59:12,212 WARN [org.hibernate.util.JDBCExceptionReporter] SQL Error: 0, SQLState: 42883
20:59:12,212 ERROR [org.hibernate.util.JDBCExceptionReporter] ERROR: function bitwise_and(integer, integer) does not exist

I've added hibernate debugging, and I tried to execute the SQL generated by Hibernate in pgadmin, and then I got this:
ERROR: function bitwise_and(integer, integer) does not exist
LINE 1: ...nsiona4_ on attributes3_.id=extensiona4_.id where bitwise_an...
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.


********** Error **********

ERROR: function bitwise_and(integer, integer) does not exist
SQL state: 42883
Hint: No function matches the given name and argument types. You might need to add explicit type casts.
Character: 1380


Top
 Profile  
 
 Post subject: Re: Custom Dialect Was working with Hibernate 3.5 but not in 3.6
PostPosted: Thu Jan 27, 2011 9:36 am 
Newbie

Joined: Sat Jan 22, 2011 3:52 pm
Posts: 3
Hi
Sorry to say i am waiting for some one hibernate guy to some way out..
Although it is ultimate need for me.. hope i will get soon some solution..

Thanks!


Top
 Profile  
 
 Post subject: Re: Custom Dialect Was working with Hibernate 3.5 but not in 3.6
PostPosted: Thu Jan 27, 2011 9:40 am 
Newbie

Joined: Thu Jun 16, 2005 7:00 am
Posts: 6
Since no one has answered this for a while, I suggest we create a Hibernate issue. I can make the issue for us!:)


Top
 Profile  
 
 Post subject: Re: Custom Dialect Was working with Hibernate 3.5 but not in 3.6
PostPosted: Thu Jan 27, 2011 9:53 am 
Newbie

Joined: Sat Jan 22, 2011 3:52 pm
Posts: 3
Yes you are right!could you do that !


Top
 Profile  
 
 Post subject: Re: Custom Dialect Was working with Hibernate 3.5 but not in 3.6
PostPosted: Thu Jan 27, 2011 5:30 pm 
Newbie

Joined: Thu Jun 16, 2005 7:00 am
Posts: 6
Here is the issue, please vote:)
http://opensource.atlassian.com/project ... e/HHH-5877


Top
 Profile  
 
 Post subject: Re: Custom Dialect Was working with Hibernate 3.5 but not in 3.6
PostPosted: Wed Mar 02, 2011 10:16 am 
Newbie

Joined: Thu Jun 16, 2005 7:00 am
Posts: 6
Today I figured out what was wrong in my situation, a method signature in SQLFunction.java interface had changed between Hibernate 3.3.0.GA (which we previously used) and Hibernate 3.6.0.Final (which is bundled with JBoss 6.0.0.Final):

Hibernate 3.3.0.GA:
SQLFunction.java: public String render(List args, SessionFactoryImplementor factory) throws QueryException;

Hibernate 3.6.0.Final:
SQLFunction.java: public String render(Type firstArgumentType, List arguments, SessionFactoryImplementor factory) throws QueryException;

When I updated my custom function (which extended StandardSQLFunction and implemented SQLFunction) to use the new method signature everything started to work!!


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