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: Formula using a filter parameter
PostPosted: Fri Sep 10, 2010 7:53 pm 
Newbie

Joined: Fri Sep 10, 2010 6:43 pm
Posts: 1
I am using the following filter in my data object:
@FilterDef(name="accountDecryption", parameters=@ParamDef(name="password", type="java.lang.String"))

and using the below formula to decrypt(DB2) the encrypted account_number:
@Formula( "decrypt_char(account_number,:accountDecryption.password)")

and I am setting the parameter prior to the query being fired as such:
template.getSession().enableFilter("accountDecryption").setParameter("password", "[password_Location]");

The filter parameter gets set properly, but the Formula does not populate with the actual value, the hql is as follows:
decrypt_char(employerba0_.account_number,:accountDecryption.password)

I get a DB2 (-313) error:
THE NUMBER OF HOST VARIABLES SPECIFIED IS NOT EQUAL TO THE NUMBER OF PARAMETER MARKERS

Does anyone have any insight into this problem or another way to implement an sql function with annotations?


Top
 Profile  
 
 Post subject: Re: Formula using a filter parameter
PostPosted: Fri Sep 10, 2010 11:19 pm 
Regular
Regular

Joined: Sun Feb 14, 2010 3:29 pm
Posts: 58
Location: USA
A typical @Formula on a property is for SQL expression that retrieve data from your DB, not for parameter binding use. Why don't you try using a normal JPA QL, which will take named parameter.

_________________
Zemian Deng
------------
Need a Java Scheduler? Try
http://bitbucket.org/timemachine/scheduler


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.