Hi Devin, 2016-05-25 20:28 GMT+02:00 Devin Austin <[email protected]>:
> Hi again Lukas, > > So, I've hit a bit of a wall. I'm not able to get the POJO type correct > for my mapper method, which may not be a huge deal, since there's only one > column/attribute that I need to mess with to make sure it contains a valid > value, but making this "just work" would be a lot easier than refactoring > that logic out somewhere else. > > This is the error I'm seeing: > [ERROR] > /home/devin/projects/lumos-gallery/gallery/src/main/java/com/lumos/service/ImageService.java:[32,8] > com.lumos.service.ImageService is not abstract and does not override > abstract method mapper() in com.lumos.service.BaseService > [ERROR] > /home/devin/projects/lumos-gallery/gallery/src/main/java/com/lumos/service/ImageService.java:[102,48] > mapper() in com.lumos.service.ImageService cannot override mapper() in > com.lumos.service.BaseService > [ERROR] return type > org.jooq.RecordMapper<com.lumos.db.tables.records.ImagesRecord,com.lumos.db.tables.pojos.Images> > is not compatible with > org.jooq.RecordMapper<org.jooq.Record,com.lumos.db.tables.pojos.Images> > [ERROR] > /home/devin/projects/lumos-gallery/gallery/src/main/java/com/lumos/service/ImageService.java:[101,3] > method does not override or implement a method from a supertype > [ERROR] > /home/devin/projects/lumos-gallery/gallery/src/main/java/com/lumos/service/GalleryService.java:[29,8] > com.lumos.service.GalleryService is not abstract and does not override > abstract method mapper() in com.lumos.service.BaseService > [ERROR] > /home/devin/projects/lumos-gallery/gallery/src/main/java/com/lumos/service/GalleryService.java:[150,54] > mapper() in com.lumos.service.GalleryService cannot override mapper() in > com.lumos.service.BaseService > [ERROR] return type > org.jooq.RecordMapper<com.lumos.db.tables.records.GalleriesRecord,com.lumos.db.tables.pojos.Galleries> > is not compatible with > org.jooq.RecordMapper<org.jooq.Record,com.lumos.db.tables.pojos.Galleries> > [ERROR] > /home/devin/projects/lumos-gallery/gallery/src/main/java/com/lumos/service/GalleryService.java:[149,3] > method does not override or implement a method from a supertype > > Here's the pertinent code: > https://gist.github.com/dhoss/09a3e3a074e975a91e9274a027b12d2c > Aah, the joys of generics and covariant overriding... The fix is actually very simple: You declared protected abstract RecordMapper<Record, P> mapper(); You implemented: protected RecordMapper<GalleriesRecord, Galleries> mapper() { ... Those signatures are not compatible, just like List<Integer> is not a subtype of List<Number> (if you're interested about the details, you'll find lots of explanations e.g. on Stack Overflow: http://stackoverflow.com/q/30498190/521799) Long story short, your declaration should read: protected abstract RecordMapper<R, P> mapper(); Hope this helps. I'll reply to your remaining points later on. Best Regards, Lukas -- You received this message because you are subscribed to the Google Groups "jOOQ User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
