Hi there,
I'm trying to implement a custom repository for a MongoDB entity, but it doesn't seem to be recognized...
I have this :
First, I tried with and abstract class :Code:@RooRepositoryMongo(domainType = Organization.class) public interface OrganizationRespository { List<Organization> findAll(); long countByDomain(String domain); }
No luck, I always get a "no property count found for type long" at runtime. (The truth is that I can't have the count*() methods to work. That's why I try to implement it myself. But I'll need to implement custom query methods anyway)Code:public abstract class OrganizationRepositoryImpl extends OrganizationRepository { @Autowired MongoTemplate mongoTemplate; public long countByDomain(String domain) { .... } }
I also tried with a custom interface (OrganizationRepositoryCustom) like so :
No luck. Same error. Every time I invoke an interface method, it seems proxied behind the scenes by this dymanic repo implementation. My implementation does not work...Code:@RooRepositoryMongo(domainType = Organization.class) public interface OrganizationRespository extends OrganizationRepositoryCustom { List<Organization> findAll(); } public interface OrganizationRepositoryCustom { public long countByDomain(String domain); } public class OrganizationRepositoryCustomImpl implements OrganizationRepositoryCustom { @Autowired MongoTemplate mongoTemplate; @Override public long countByDomain(String domain) { ... } }
So, what's the right way ? Am I missing some annotation parameters (I think Roo makes things even worse to see clear) ?
Thanks in advance,
Bardamu


Reply With Quote