At the moment I moved forward. In ROO-931 its says us "At the moment
the gwt setup command generates request objects for all finder
methods" (from here
https://jira.springsource.org/browse/ROO-931?page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#issue-tabs).
I added 'finder' using Roo shell command: finder add
findEmployeesByDepartmentEquals
After that Roo generated me an Aspect:

privileged aspect Employee_Roo_Finder {

    public static Query
Employee.findEmployeesByDepartmentEquals(String department) {
        if (department == null || department.length() == 0) throw new
IllegalArgumentException("The department argument is required");
        EntityManager em = Employee.entityManager();
        Query q = em.createQuery("SELECT Employee FROM Employee AS
employee WHERE employee.department = :department");
        q.setParameter("department", department);
        return q;
    }

and added anotation to Employee.java:  @RooEntity(finders =
{"findEmployeesByDepartmentEquals"})
but no request objects generated. My EmployeeRequest.java (generated
and maintained by Roo) looks as follows (I can't see finder methods
there):

@RooGwtMirroredFrom("org.springsource.roo.extrackgae.server.domain.Employee")
@ServiceName("org.springsource.roo.extrackgae.server.domain.Employee")
public interface EmployeeRequest extends RequestContext {

    abstract Request<java.lang.Long> countEmployees();

    abstract
Request<java.util.List<org.springsource.roo.extrackgae.client.managed.request.EmployeeProxy>>
findAllEmployees();

    abstract
Request<java.util.List<org.springsource.roo.extrackgae.client.managed.request.EmployeeProxy>>
findEmployeeEntries(int firstResult, int maxResults);

    abstract
Request<org.springsource.roo.extrackgae.client.managed.request.EmployeeProxy>
findEmployee(Long id);

    abstract
InstanceRequest<org.springsource.roo.extrackgae.client.managed.request.EmployeeProxy,
java.lang.Void> remove();

    abstract
InstanceRequest<org.springsource.roo.extrackgae.client.managed.request.EmployeeProxy,
java.lang.Void> persist();
}

Tell me please where I'm wrong? How to make finder methods works?

On 25 фев, 17:00, Zed <zed...@gmail.com> wrote:
>     Hellow everyone, I started to deal with GWT+roo scaffolding ap and
> found the idea very cool. Thank you guys!
> But I found it hard for me to understanf how to implement custom
> "find" methods like for example -  findAllEmployeesByName.
> I looked all the documentations and it's written there that I can add
> this method to Entity object itself like this:
>
>  @RooJavaBean
>  @RooToString
>  @RooEntity
> public class Employee {
>
> .....
>
>     @NotNull
>     private String displayName;
>
>     @SuppressWarnings("unchecked")
>     public static List<Employee> findAllEmployeesByName(String name){
>         return entityManager().createQuery("select ....... from Employee
> o").getResultList();
>     }}
>
> I added it but nothing happend. No code generation started.
> I see all finder methods are in Aspects which are generated by Roo
> itself and I can't put my code there.
> Can you guys give me some hint please.
>
> With respect
> Andrew Efremov

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to