on 2019 Sep 16 1:42 PM
Hello,
I need your help to know how could I get all Cstickets items and save them in a list<CsTicketModel>, so that, I will be able to know the attibutes for each item using a loop.
I have tried the attached code, but a get an error. It shows "Unable to evalue the expression Method threw 'Java.lang.IllegalArgumentException' exception".
Please your help.
Thanks in advance.
Request clarification before answering.
Hi,
You are supposed to write the query so that you are fetching the PK for the model you need. So in your case the query should be something like:
Select {pk} from {CsTicket}this should work for you.
Alternatively you can use DefaultGenericDao you should extend your dao with DefaultGenericDao and the constructor and call the find method to get the results.
this should work for you too.
please have a look at the sample code below:
public class DefaultCsTicketDao extends DefaultGenericDao<CsTicketModel> implements CsTicketDao
{
public DefaultCsTicketDao()
{
super(CsTicketModel._TYPECODE);
}
@Override
public CsTicketModel getNumberSeries(final String csTicketid)
{
final Map<String, Object> params = new HashMap<>();
params.put(CsTicketModel.UID, csTicketid);
final List<CsTicketModel> tickets = this.find(params);
return CollectionUtils.isNotEmpty(tickets) ? tickets.get(0) : null;
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.