-->
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.  [ 2 posts ] 
Author Message
 Post subject: Registering REGEXP_LIKE in a extended Oracle10gDialect class
PostPosted: Thu Aug 11, 2011 3:59 am 
Newbie

Joined: Thu Aug 11, 2011 3:08 am
Posts: 1
I'm attempting to use the following named query:
Code:
        @NamedQuery(name="entryList.forSearch", query="from Entry e where regexp_like(e.term, :regex, 'i')")



I've tried all three versions commented out below for the constructor of my own dialect but receive the same exception for all 3.

Code:
public class NewOracle10gDialect extends org.hibernate.dialect.Oracle10gDialect {
    public NewOracle10gDialect() {
        super();
//        registerFunction("regexp_like", new VarArgsSQLFunction(new BooleanType(), "REGEXP_LIKE", ",", ")"));
//        registerFunction("regexp_like", new StandardSQLFunction("REGEXP_LIKE", new BooleanType()));
//        registerFunction("regexp_like", new SQLFunctionTemplate(new BooleanType(),"REGEXP_LIKE(?1, ?2, ?3)"));
    }
}


The Exception I get is:
Code:
org.hibernate.hql.ast.QuerySyntaxException: unexpected AST node: ( near line 1, column 60 [from com.gem.entity.Entry e where regexp_like(e.term, :regex, 'i')]
   at org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:54)
   at org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:47)


Is there a reason why this wasn't implemented for Oracle already?
And has anyone had any luck getting this working?

Thanks in advance!


Top
 Profile  
 
 Post subject: Re: Registering REGEXP_LIKE in a extended Oracle10gDialect class
PostPosted: Fri Oct 19, 2012 12:32 pm 
Newbie

Joined: Fri Oct 19, 2012 12:24 pm
Posts: 1
This topic is pretty outdated, but since google queries end up here, it's a good idea to link to a working solution on stackoverflow:

http://stackoverflow.com/questions/11793159/how-to-use-oracles-regexp-like-in-hibernate-hql/12976962#12976962


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