[jboss-user] [JBoss Seam] - Problem with EntityQuery, Design Question about it
Eethyo
do-not-reply at jboss.com
Thu Oct 25 01:34:35 EDT 2007
Hi,
I used Seam-gen to create a CRUD Application out of my database.
Works fine so far, but i now i, of course, need to customize it for my needs.
I need to run a query and i think i should use the package com.ccms30.entities;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.framework.EntityQuery;
import java.util.List;
import java.util.Arrays;
@Name("ccmsProductlineList")
| public class CcmsProductlineList extends EntityQuery {
|
| /**
| *
| */
| private static final long serialVersionUID = 1L;
|
| private static final String[] RESTRICTIONS = {
| "lower(ccmsProductline.name) like concat(lower(#{ccmsProductlineList.ccmsProductline.name}),'%')",
| "lower(ccmsProductline.description) like concat(lower(#{ccmsProductlineList.ccmsProductline.description}),'%')",};
|
| private CcmsProductline ccmsProductline = new CcmsProductline();
|
| @Override
| public String getEjbql() {
| return "select ccmsProductline from CcmsProductline ccmsProductline";
| }
|
| @Override
| public Integer getMaxResults() {
| return 25;
| }
|
| public CcmsProductline getCcmsProductline() {
| return ccmsProductline;
| }
|
| @Override
| public List<String> getRestrictions() {
| return Arrays.asList(RESTRICTIONS);
| }
|
| }
this Class for it.
So here are my questions:
- How should i run a query on an attribute? just, for example, set the name in object ccmsProductline and then run getResultList? or should i write an own class? how to design my own querys, which are nothing else than a list so far?
- Why can i just use this class if I inject it into my the Bean i call it from?
I cant create CcmsProductline ccmsProductline = new CcmsProductline(); and then use it... why? Would make things much more easy.
Thanks a lot.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4098652#4098652
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4098652
More information about the jboss-user
mailing list