[
https://issues.jboss.org/browse/SEAMPERSIST-63?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12619403#comment-12619403
]
Frank Cornelis commented on SEAMPERSIST-63:
-------------------------------------------
I've tried to used @ServiceHandler at first. But this one required the
implementing handler class to be accessible from within an API annotation
(@ServiceHandlerType), which would kind of void the separation between API and
impl. This way, the query interface also doesn't need a TYPE annotation
@QueryInterface (which would have a meta-annotation @ServiceHandlerType if
implemented via Solder ServiceHandler). The QueryInterfaceExtension marks an
interface as being a query interface by creating a corresponding bean if the
interface contains a method annotated with @QueryMethod, which is quite clean.
The @Inject also doesn't need any qualifier, it can directly inject the query
interface proxies.
Anyway, as I'm new to CDI, there are probably cleaner ways to implement this
feature.
I'll try setting up a github thing.
> Query Interface
> ---------------
>
> Key: SEAMPERSIST-63
> URL: https://issues.jboss.org/browse/SEAMPERSIST-63
> Project: Seam Persistence
> Issue Type: Feature Request
> Reporter: Frank Cornelis
> Priority: Minor
> Attachments: 0001-Query-Interface.patch, 0002-Update-queries.patch,
> 0003-Pagination.patch, 0004-Query-Interface-injection.patch,
> 0005-javadoc.patch
>
>
> The query interface allows for easy usage of JPA queries. Basically you
> annotate an interface as follows:
> {code}
> public interface QueryInterface {
> @QueryMethod("person.query.all")
> List<Person> getAll();
> @QueryMethod("person.select.by.name")
> Person getPersonByName(@QueryParam("name") String name);
> @QueryMethod(value = "person.select.by.name", nullable = true)
> Person findPersonByName(@QueryParam("name") String name);
> @QueryMethod("person.query.all")
> Query getAllQuery();
>
> @QueryMethod(query = "SELECT COUNT(*) FROM Person")
> Long countAll();
> }
> {code}
> Using some inject QueryInterfaceFactory you can get a proxy on this interface
> that will interpret the annotations towards JPA queries. See attached patch
> for a basic implementation.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
_______________________________________________
seam-issues mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/seam-issues