You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltaspike.apache.org by "John D. Ament (JIRA)" <ji...@apache.org> on 2018/03/07 17:42:00 UTC

[jira] [Commented] (DELTASPIKE-1177) [Deltaspike Data] Regoznize Entity Type by method returned type if @Repository.forEntity is set to default

    [ https://issues.apache.org/jira/browse/DELTASPIKE-1177?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16389866#comment-16389866 ] 

John D. Ament commented on DELTASPIKE-1177:
-------------------------------------------

Hi [~tibor17] basically, the issue is that the entity object is known at the repository layer not the method layer [https://github.com/apache/deltaspike/blob/master/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/meta/RepositoryMetadata.java]

 

For your use case to work, you need to move that entity, or duplicate it, at the method level.  

> [Deltaspike Data] Regoznize Entity Type by method returned type if @Repository.forEntity is set to default
> ----------------------------------------------------------------------------------------------------------
>
>                 Key: DELTASPIKE-1177
>                 URL: https://issues.apache.org/jira/browse/DELTASPIKE-1177
>             Project: DeltaSpike
>          Issue Type: Improvement
>          Components: Data-Module
>    Affects Versions: 1.7.0
>            Reporter: Tibor Digana
>            Priority: Major
>
> I want to use Deltaspike Data Repo as a Service because it is simplistic and not DAO.
> Since of service operates over multiple entities I want the extension to recognize the Entity type dynamically by method return type.
> Notice the example does not implement _EntityRepository_ and therefore the only return type should be checked.
> {code}
> @Repository
> public interface Java8Repository {
>   MyEntity findByCourse(@NotNull String courseName);
>   AnotherEntity findByCustomer(@NotNull String customerName);
>   @Query("........")
>   Object[] findMultipleEntityTypes(@NotNull String attribute);
> }
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)