0

HQL Language

asked 2009-12-10 08:34:10 +0800

JoH gravatar image JoH
105 2 3

Dear All,

I wrote a hql query for searching multiple criteria as follows.

@SuppressWarnings("unchecked")
public List<Item> findAllAdvance(String advance) {
String hql = "FROM Item WHERE description = ? and multi = ? and charge = ? ";
return getHibernateTemplate().find(hql, advance);
}

And then wrote a java class and its implementation like this.

public void submit2(){
String advance = ((Textbox)getFellow("advance")).getValue().trim();

Listbox listbox = (Listbox)getFellow("items");
listbox.getItems().clear();

ApplicationContext ctx =
WebApplicationContextUtils.getRequiredWebApplicationContext(
(ServletContext)getDesktop().getWebApp().getNativeContext());

Adminop admin = (Adminop)ctx.getBean("adminop");


List<Item> items = admin.getSearchedItem2(advance);
Iterator<Item> it = items.iterator();
while(it.hasNext()){
Item item = (Item)it.next();

Listitem li = new Listitem();
li.setValue(item);
li.appendChild(new Listcell(item.getFilepath()));
li.appendChild(new Listcell(item.getStrform()));
li.appendChild(new Listcell(item.getDescription()));
li.appendChild(new Listcell(item.getQcmeth()));
li.appendChild(new Listcell(item.getBasisset()));
li.appendChild(new Listcell(item.getInfo()));
li.appendChild(new Listcell(item.getPg()));
li.appendChild(new Listcell(item.getEs()));
li.appendChild(new Listcell(item.getMulti()));
li.appendChild(new Listcell(item.getCharge()));
li.appendChild(new Listcell(item.getEnergy()));
li.appendChild(new Listcell(item.getEnthalpy()));
listbox.appendChild(li);
}
}

The problem is,

If I write the 3 strings, let's say "cysteine 1 0", in the textbox with the id "advance" and run it,

it doesn't recognise it as 3 separated parameters [1] [0] but only as a single parameter [cysteine 1 0].

how could I make it that the strings which I wrote in the textbox can be recognised as 3 parameters, so that hql can know?

delete flag offensive retag edit

2 Replies

Sort by ยป oldest newest

answered 2009-12-10 09:15:27 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

updated 2009-12-10 09:16:07 +0800

Please, Don't cross post.

Only a hint!
If you will write 3 parameters in one line of a textbox! How do you secure the inputs.
If it's not better to do the 3 Parameters in 3 different textboxes?

link publish delete flag offensive edit

answered 2009-12-10 18:44:59 +0800

PeterKuo gravatar image PeterKuo
481 2

Please respect other users.
Don't cross post.

Please refer to http://www.zkoss.org/forum/listComment/10586

I'll move this discussion from category "General" to "Help".

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2009-12-10 08:34:10 +0800

Seen: 371 times

Last updated: Dec 10 '09

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More