Hello,
I have a class called ClientAccount that has two primary keys (clientId and instanceId). I have created another class called ClientAccountId to manage the two primary keys (in this class i have extended serializable and implemented hashCode and equals methods).
Now I want to query the database and ask for all the entries where instaceId=3 and clientId contains 'DER'.
Is this the query?
in mapping file:
advancedQuery= "from ClientAccount g where g.ClientAccountId = :ClientAccountId";
ClientAccountId account = new ClientAccountId();
account.setClientId("%DER%");
account.setFeedInstanceId("3");
Query clientNames = session.getNamedQuery(advanceQuery);
clientNames.setEntity("ClientAccountId", account);
List results = clientNames.list();
it gives errors, anyone can help me to retrieve this list ?? do i have to implement serializable and include the two methods in the class ClientAccount as well?
Thanks
|