When I have to make a custom finder, I follow these steps:
1.- Create a finder with the Roo command.
Something like findMyEntityByValueEquals. With that a _Roo_Finder aspectJ is created, and the @RooJpaActiveRecord annotation modified with the appropriate finders atribute (for instance finders = { "findMyEntityByValueEquals" })
2.- I copy the finder method to the Java Entity and then I modify it (including the signature, of course)
So try to remove findForMe from the annotation (because you're telling Roo to manage this finder, so Roo tries to create/delete or whatever it considers appropriate)
Code:
@RooJpaActiveRecord(...)
public class MyEntity {
public static TypedQuery<MyEntity> findForMe(String me) {
if (me== null || me.length() == 0) throw new IllegalArgumentException("The meargument is required for finding MyEntities");
EntityManager em = MyEntity.entityManager();
//Or whatever custom JPA-QL query (not plain SQL query)
TypedQuery<MyEntity> q = em.createQuery("SELECT o FROM MyEntity AS o WHERE o.me = :me", MyEntity.class);
q.setParameter("me", me);
return q;
}
}
3.- Add tests to the MyEntityIntegrationTest