REGEX in OQL Query -
i wanted use regexp while querying oql objects, select
statement be:
select o testobject o ((o.name regexp '^d') )
but here getting exception like
2015-07-23 15:53:50,081 error [workerthread#2[127.0.0.1:36335]] centina.sa.server.common.object.session.readonlyobjectsessionbean object java.lang.illegalargumentexception: org.hibernate.hql.ast.querysyntaxexception: unexpected token: regexp near line 1, column 74 [select o centina.sa.model.topology.networkelement o ((o.name regexp '^d') ) ] @ org.hibernate.ejb.abstractentitymanagerimpl.throwpersistenceexception(abstractentitymanagerimpl.java:603) @ org.hibernate.ejb.abstractentitymanagerimpl.createquery(abstractentitymanagerimpl.java:96) @ org.jboss.jpa.tx.transactionscopedentitymanager.createquery(transactionscopedentitymanager.java:139) @ centina.sa.server.common.object.session.readonlyobjectsessionbean.getallobjects(readonlyobjectsessionbean.java:1905) @ centina.sa.server.common.object.session.readonlyobjectsessionbean.getallobjects(readonlyobjectsessionbean.java:1674) @ centina.sa.server.common.object.session.readonlyobjectsessionbean.getallobjects(readonlyobjectsessionbean.java:1638) @ sun.reflect.generatedmethodaccessor1158.invoke(unknown source) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:606) @ org.jboss.aop.joinpoint.methodinvocation.invoketarget(methodinvocation.java:122) @ org.jboss.aop.joinpoint.methodinvocation.invokenext(methodinvocation.java:111) @ org.jboss.ejb3.interceptors.container.containermethodinvocationwrapper.invokenext(containermethodinvocationwrapper.java:72) @ org.jboss.ejb3.interceptors.aop.interceptorsequencer.invoke(interceptorsequencer.java:76) @ org.jboss.ejb3.interceptors.aop.interceptorsequencer.aroundinvoke(interceptorsequencer.java:62) @ sun.reflect.generatedmethodaccessor379.invoke(unknown source) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:606) @ org.jboss.aop.advice.perjoinpointadvice.invoke(perjoinpointadvice.java:174) @ org.jboss.aop.joinpoint.methodinvocation.invokenext(methodinvocation.java:102) @ org.jboss.ejb3.interceptors.aop.invocationcontextinterceptor.fillmethod(invocationcontextinterceptor.java:72) @ org.jboss.aop.advice.org.jboss.ejb3.interceptors.aop.invocationcontextinterceptor_z_fillmethod_1512708358.invoke(invocationcontextinterceptor_z_fillmethod_1512708358.java) @ org.jboss.aop.joinpoint.methodinvocation.invokenext(methodinvocation.java:102) @ org.jboss.ejb3.interceptors.aop.invocationcontextinterceptor.setup(invocationcontextinterceptor.java:88) @ org.jboss.aop.advice.org.jboss.ejb3.interceptors.aop.invocationcontextinterceptor_z_setup_1512708358.invoke(invocationcontextinterceptor_z_setup_1512708358.java) @ org.jboss.aop.joinpoint.methodinvocation.invokenext(methodinvocation.java:102) @ org.jboss.ejb3.connectionmanager.cachedconnectioninterceptor.invoke(cachedconnectioninterceptor.java:62) @ org.jboss.aop.joinpoint.methodinvocation.invokenext(methodinvocation.java:102) @ org.jboss.ejb3.entity.transactionscopedentitymanagerinterceptor.invoke(transactionscopedentitymanagerinterceptor.java:56) @ org.jboss.aop.joinpoint.methodinvocation.invokenext(methodinvocation.java:102) @ org.jboss.ejb3.allowedoperationsinterceptor.invoke(allowedoperationsinterceptor.java:47) @ org.jboss.aop.joinpoint.methodinvocation.invokenext(methodinvocation.java:102) @ org.jboss.ejb3.tx.nullinterceptor.invoke(nullinterceptor.java:42) @ org.jboss.aop.joinpoint.methodinvocation.invokenext(methodinvocation.java:102) @ org.jboss.ejb3.stateless.statelessinstanceinterceptor.invoke(statelessinstanceinterceptor.java:68) @ org.jboss.aop.joinpoint.methodinvocation.invokenext(methodinvocation.java:102) @ org.jboss.aspects.tx.txpolicy.invokeincallertx(txpolicy.java:126) @ org.jboss.aspects.tx.txinterceptor$required.invoke(txinterceptor.java:194) @ org.jboss.aop.joinpoint.methodinvocation.invokenext(methodinvocation.java:102) @ org.jboss.aspects.tx.txpropagationinterceptor.invoke(txpropagationinterceptor.java:76) @ org.jboss.aop.joinpoint.methodinvocation.invokenext(methodinvocation.java:102) @ org.jboss.ejb3.security.runassecurityinterceptorv2.invoke(runassecurityinterceptorv2.java:105) @ org.jboss.aop.joinpoint.methodinvocation.invokenext(methodinvocation.java:102) @ org.jboss.ejb3.security.rolebasedauthorizationinterceptorv2.invoke(rolebasedauthorizationinterceptorv2.java:201) @ org.jboss.aop.joinpoint.methodinvocation.invokenext(methodinvocation.java:102) @ org.jboss.ejb3.security.ejb3authenticationinterceptorv2.invoke(ejb3authenticationinterceptorv2.java:182) @ org.jboss.aop.joinpoint.methodinvocation.invokenext(methodinvocation.java:102) @ org.jboss.ejb3.encpropagationinterceptor.invoke(encpropagationinterceptor.java:41) @ org.jboss.aop.joinpoint.methodinvocation.invokenext(methodinvocation.java:102) @ org.jboss.ejb3.blockcontainershutdowninterceptor.invoke(blockcontainershutdowninterceptor.java:67) @ org.jboss.aop.joinpoint.methodinvocation.invokenext(methodinvocation.java:102) @ org.jboss.ejb3.core.context.currentinvocationcontextinterceptor.invoke(currentinvocationcontextinterceptor.java:47) @ org.jboss.aop.joinpoint.methodinvocation.invokenext(methodinvocation.java:102) @ org.jboss.aspects.currentinvocation.currentinvocationinterceptor.invoke(currentinvocationinterceptor.java:67) @ org.jboss.aop.joinpoint.methodinvocation.invokenext(methodinvocation.java:102) @ org.jboss.ejb3.interceptor.ejb3tcclinterceptor.invoke(ejb3tcclinterceptor.java:86) @ org.jboss.aop.joinpoint.methodinvocation.invokenext(methodinvocation.java:102) @ org.jboss.ejb3.session.sessionspeccontainer.invoke(sessionspeccontainer.java:193) @ org.jboss.ejb3.session.sessionspeccontainer.invoke(sessionspeccontainer.java:250) @ org.jboss.ejb3.proxy.impl.handler.session.sessionproxyinvocationhandlerbase.invoke(sessionproxyinvocationhandlerbase.java:188) @ com.sun.proxy.$proxy285.getallobjects(unknown source) @ centina.sa.server.topology.session.topologysessionbean.getnetworkelements(topologysessionbean.java:1752) @ sun.reflect.generatedmethodaccessor1157.invoke(unknown source) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:606) @ org.jboss.aop.joinpoint.methodinvocation.invoketarget(methodinvocation.java:122) @ org.jboss.aop.joinpoint.methodinvocation.invokenext(methodinvocation.java:111) @ org.jboss.ejb3.interceptors.container.containermethodinvocationwrapper.invokenext(containermethodinvocationwrapper.java:72) @ org.jboss.ejb3.interceptors.aop.invocationcontextinterceptor$invocationcontext.proceed(invocationcontextinterceptor.java:138) @ centina.sa.server.fault.interceptor.databasechangeinterceptor.log(databasechangeinterceptor.java:106) @ sun.reflect.generatedmethodaccessor680.invoke(unknown source) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:606) @ org.jboss.ejb3.interceptors.aop.ejb3interceptorinterceptor.invoke(ejb3interceptorinterceptor.java:83) @ org.jboss.ejb3.interceptors.aop.ejb3interceptorinterceptor.invoke(ejb3interceptorinterceptor.java:70) @ org.jboss.ejb3.interceptors.container.containermethodinvocationwrapper.invokenext(containermethodinvocationwrapper.java:62) @ org.jboss.ejb3.interceptors.aop.invocationcontextinterceptor$invocationcontext.proceed(invocationcontextinterceptor.java:138) @ centina.sa.server.security.interceptor.logginginterceptor.log(logginginterceptor.java:163) @ sun.reflect.generatedmethodaccessor1048.invoke(unknown source) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:606) @ org.jboss.ejb3.interceptors.aop.ejb3interceptorinterceptor.invoke(ejb3interceptorinterceptor.java:83) @ org.jboss.ejb3.interceptors.aop.ejb3interceptorinterceptor.invoke(ejb3interceptorinterceptor.java:70) @ org.jboss.ejb3.interceptors.container.containermethodinvocationwrapper.invokenext(containermethodinvocationwrapper.java:62) @ org.jboss.ejb3.interceptors.aop.interceptorsequencer.invoke(interceptorsequencer.java:76) @ org.jboss.ejb3.interceptors.aop.interceptorsequencer.aroundinvoke(interceptorsequencer.java:62) @ sun.reflect.generatedmethodaccessor379.invoke(unknown source) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:606) @ org.jboss.aop.advice.perjoinpointadvice.invoke(perjoinpointadvice.java:174) @ org.jboss.aop.joinpoint.methodinvocation.invokenext(methodinvocation.java:102) @ org.jboss.ejb3.interceptors.aop.invocationcontextinterceptor.fillmethod(invocationcontextinterceptor.java:72) @ org.jboss.aop.advice.org.jboss.ejb3.interceptors.aop.invocationcontextinterceptor_z_fillmethod_1512708358.invoke(invocationcontextinterceptor_z_fillmethod_1512708358.java) @ org.jboss.aop.joinpoint.methodinvocation.invokenext(methodinvocation.java:102) @ org.jboss.ejb3.interceptors.aop.invocationcontextinterceptor.setup(invocationcontextinterceptor.java:88) @ org.jboss.aop.advice.org.jboss.ejb3.interceptors.aop.invocationcontextinterceptor_z_setup_1512708358.invoke(invocationcontextinterceptor_z_setup_1512708358.java) @ org.jboss.aop.joinpoint.methodinvocation.invokenext(methodinvocation.java:102) @ org.jboss.ejb3.connectionmanager.cachedconnectioninterceptor.invoke(cachedconnectioninterceptor.java:62) @ org.jboss.aop.joinpoint.methodinvocation.invokenext(methodinvocation.java:102) @ org.jboss.ejb3.entity.transactionscopedentitymanagerinterceptor.invoke(transactionscopedentitymanagerinterceptor.java:56) @ org.jboss.aop.joinpoint.methodinvocation.invokenext(methodinvocation.java:102) @ org.jboss.ejb3.allowedoperationsinterceptor.invoke(allowedoperationsinterceptor.java:47) @ org.jboss.aop.joinpoint.methodinvocation.invokenext(methodinvocation.java:102) @ org.jboss.ejb3.tx.nullinterceptor.invoke(nullinterceptor.java:42) @ org.jboss.aop.joinpoint.methodinvocation.invokenext(methodinvocation.java:102) @ org.jboss.ejb3.stateless.statelessinstanceinterceptor.invoke(statelessinstanceinterceptor.java:68) @ org.jboss.aop.joinpoint.methodinvocation.invokenext(methodinvocation.java:102) @ org.jboss.aspects.tx.txpolicy.invokeinourtx(txpolicy.java:79) @ org.jboss.aspects.tx.txinterceptor$required.invoke(txinterceptor.java:190) @ org.jboss.aop.joinpoint.methodinvocation.invokenext(methodinvocation.java:102) @ org.jboss.aspects.tx.txpropagationinterceptor.invoke(txpropagationinterceptor.java:67) @ org.jboss.aop.joinpoint.methodinvocation.invokenext(methodinvocation.java:102) @ org.jboss.ejb3.security.runassecurityinterceptorv2.invoke(runassecurityinterceptorv2.java:105) @ org.jboss.aop.joinpoint.methodinvocation.invokenext(methodinvocation.java:102) @ org.jboss.ejb3.security.rolebasedauthorizationinterceptorv2.invoke(rolebasedauthorizationinterceptorv2.java:201) @ org.jboss.aop.joinpoint.methodinvocation.invokenext(methodinvocation.java:102) @ org.jboss.ejb3.security.ejb3authenticationinterceptorv2.invoke(ejb3authenticationinterceptorv2.java:182) @ org.jboss.aop.joinpoint.methodinvocation.invokenext(methodinvocation.java:102) @ org.jboss.ejb3.encpropagationinterceptor.invoke(encpropagationinterceptor.java:41) @ org.jboss.aop.joinpoint.methodinvocation.invokenext(methodinvocation.java:102) @ org.jboss.ejb3.blockcontainershutdowninterceptor.invoke(blockcontainershutdowninterceptor.java:67) @ org.jboss.aop.joinpoint.methodinvocation.invokenext(methodinvocation.java:102) @ org.jboss.ejb3.core.context.currentinvocationcontextinterceptor.invoke(currentinvocationcontextinterceptor.java:47) @ org.jboss.aop.joinpoint.methodinvocation.invokenext(methodinvocation.java:102) @ org.jboss.aspects.currentinvocation.currentinvocationinterceptor.invoke(currentinvocationinterceptor.java:67) @ org.jboss.aop.joinpoint.methodinvocation.invokenext(methodinvocation.java:102) @ org.jboss.ejb3.interceptor.ejb3tcclinterceptor.invoke(ejb3tcclinterceptor.java:86) @ org.jboss.aop.joinpoint.methodinvocation.invokenext(methodinvocation.java:102) @ org.jboss.ejb3.stateless.statelesscontainer.dynamicinvoke(statelesscontainer.java:361) @ org.jboss.ejb3.session.invokablecontextclassproxyhack._dynamicinvoke(invokablecontextclassproxyhack.java:53) @ org.jboss.aop.dispatcher.invoke(dispatcher.java:91) @ org.jboss.aspects.remoting.aopremotinginvocationhandler.invoke(aopremotinginvocationhandler.java:82) @ org.jboss.remoting.serverinvoker.invoke(serverinvoker.java:967) @ org.jboss.remoting.transport.socket.serverthread.completeinvocation(serverthread.java:791) @ org.jboss.remoting.transport.socket.serverthread.processinvocation(serverthread.java:744) @ org.jboss.remoting.transport.socket.serverthread.dorun(serverthread.java:586) @ org.jboss.remoting.transport.socket.serverthread.run(serverthread.java:234) caused by: org.hibernate.hql.ast.querysyntaxexception: unexpected token: regexp near line 1, column 74 [select o centina.sa.model.topology.networkelement o ((o.name regexp '^d') ) ] @ org.hibernate.hql.ast.querysyntaxexception.convert(querysyntaxexception.java:55) @ org.hibernate.hql.ast.querysyntaxexception.convert(querysyntaxexception.java:48) @ org.hibernate.hql.ast.errorcounter.throwqueryexception(errorcounter.java:83) @ org.hibernate.hql.ast.querytranslatorimpl.parse(querytranslatorimpl.java:285) @ org.hibernate.hql.ast.querytranslatorimpl.docompile(querytranslatorimpl.java:183) @ org.hibernate.hql.ast.querytranslatorimpl.compile(querytranslatorimpl.java:137) @ org.hibernate.engine.query.hqlqueryplan.<init>(hqlqueryplan.java:101) @ org.hibernate.engine.query.hqlqueryplan.<init>(hqlqueryplan.java:80) @ org.hibernate.engine.query.queryplancache.gethqlqueryplan(queryplancache.java:124) @ org.hibernate.impl.abstractsessionimpl.gethqlqueryplan(abstractsessionimpl.java:156) @ org.hibernate.impl.abstractsessionimpl.createquery(abstractsessionimpl.java:135) @ org.hibernate.impl.sessionimpl.createquery(sessionimpl.java:1694) @ org.hibernate.ejb.abstractentitymanagerimpl.createquery(abstractentitymanagerimpl.java:93) ... 134 more 2015-07-23 15:53:50,082 error [workerthread#2[127.0.0.1:36335]] centina.sa.server.topology.session.topologysessionbean network element centina.sa.model.error.errorcodeexception: database read failure: org.hibernate.hql.ast.querysyntaxexception: unexpected token: regexp near line 1, column 74 [select o centina.sa.model.topology.networkelement o ((o.name regexp '^d') ) ] @ centina.sa.server.common.object.session.readonlyobjectsessionbean.getallobjects(readonlyobjectsessionbean.java:2092) @ centina.sa.server.common.object.session.readonlyobjectsessionbean.getallobjects(readonlyobjectsessionbean.java:1674) @ centina.sa.server.common.object.session.readonlyobjectsessionbean.getallobjects(readonlyobjectsessionbean.java:1638) @ sun.reflect.generatedmethodaccessor1158.invoke(unknown source) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:606) @ org.jboss.aop.joinpoint.methodinvocation.invoketarget(methodinvocation.java:122) @ org.jboss.aop.joinpoint.methodinvocation.invokenext(methodinvocation.java:111) @ org.jboss.ejb3.interceptors.container.containermethodinvocationwrapper.invokenext(containermethodinvocationwrapper.java:72) @ org.jboss.ejb3.interceptors.aop.interceptorsequencer.invoke(interceptorsequencer.java:76) @ org.jboss.ejb3.interceptors.aop.interceptorsequencer.aroundinvoke(interceptorsequencer.java:62) @ sun.reflect.generatedmethodaccessor379.invoke(unknown source) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:606) @ org.jboss.aop.advice.perjoinpointadvice.invoke(perjoinpointadvice.java:174) @ org.jboss.aop.joinpoint.methodinvocation.invokenext(methodinvocation.java:102) @ org.jboss.ejb3.interceptors.aop.invocationcontextinterceptor.fillmethod(invocationcontextinterceptor.java:72) @ org.jboss.aop.advice.org.jboss.ejb3.interceptors.aop.invocationcontextinterceptor_z_fillmethod_1512708358.invoke(invocationcontextinterceptor_z_fillmethod_1512708358.java) @ org.jboss.aop.joinpoint.methodinvocation.invokenext(methodinvocation.java:102) @ org.jboss.ejb3.interceptors.aop.invocationcontextinterceptor.setup(invocationcontextinterceptor.java:88) @ org.jboss.aop.advice.org.jboss.ejb3.interceptors.aop.invocationcontextinterceptor_z_setup_1512708358.invoke(invocationcontextinterceptor_z_setup_1512708358.java) @ org.jboss.aop.joinpoint.methodinvocation.invokenext(methodinvocation.java:102) @ org.jboss.ejb3.connectionmanager.cachedconnectioninterceptor.invoke(cachedconnectioninterceptor.java:62) @ org.jboss.aop.joinpoint.methodinvocation.invokenext(methodinvocation.java:102) @ org.jboss.ejb3.entity.transactionscopedentitymanagerinterceptor.invoke(transactionscopedentitymanagerinterceptor.java:56) @ org.jboss.aop.joinpoint.methodinvocation.invokenext(methodinvocation.java:102) @ org.jboss.ejb3.allowedoperationsinterceptor.invoke(allowedoperationsinterceptor.java:47) @ org.jboss.aop.joinpoint.methodinvocation.invokenext(methodinvocation.java:102) @ org.jboss.ejb3.tx.nullinterceptor.invoke(nullinterceptor.java:42) @ org.jboss.aop.joinpoint.methodinvocation.invokenext(methodinvocation.java:102) @ org.jboss.ejb3.stateless.statelessinstanceinterceptor.invoke(statelessinstanceinterceptor.java:68) @ org.jboss.aop.joinpoint.methodinvocation.invokenext(methodinvocation.java:102) @ org.jboss.aspects.tx.txpolicy.invokeincallertx(txpolicy.java:126) @ org.jboss.aspects.tx.txinterceptor$required.invoke(txinterceptor.java:194) @ org.jboss.aop.joinpoint.methodinvocation.invokenext(methodinvocation.java:102) @ org.jboss.aspects.tx.txpropagationinterceptor.invoke(txpropagationinterceptor.java:76)...................
is there way use regex on oql object?
according java tools tutorials - herong's tutorial notes:
oql based on javascript expression language.
the regex check can performed in where
clause this:
select o testobject o "/^d/(o.name.tostring())"
it seems oql regex syntax very poor. so, not regular expressions work here.
Comments
Post a Comment