You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltaspike.apache.org by Danny02 <gi...@git.apache.org> on 2016/06/02 11:37:45 UTC

[GitHub] deltaspike pull request #52: Enable other Entity types as return from native...

GitHub user Danny02 opened a pull request:

    https://github.com/apache/deltaspike/pull/52

    Enable other Entity types as return from native repository queries

    At the moment native queries can only return the same entity type as of the repository.
    
    A special flag exist on the @Query annotation to disable mapping, this enables the possibility to return unmapped types as String, Date or Integer.
    
    This change uses the return type of the method with the @Query annotation. 
    If the type is java.util.List, it uses the generic type.
    
    It should be checked if this behaviour is correct for all JPA providers and if some special logging is needed.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/Danny02/deltaspike native_query_generic_return_fix

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/deltaspike/pull/52.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #52
    
----
commit 69cbb4fba458d090124d4262c388fbc3df4a4a3f
Author: mmain\heda151 <da...@cassidian.com>
Date:   2016-06-02T11:03:40Z

    use return type of query method in native queries to build correct entity type

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] deltaspike pull request #52: [DELTASPIKE-1160] Enable other Entity types as ...

Posted by Danny02 <gi...@git.apache.org>.
Github user Danny02 commented on a diff in the pull request:

    https://github.com/apache/deltaspike/pull/52#discussion_r65525461
  
    --- Diff: deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/builder/AnnotatedQueryBuilder.java ---
    @@ -88,4 +83,12 @@ else if (query.isNative())
             return context.applyRestrictions(result);
         }
     
    +    private Class<?> getMethodResultEntityClass(Method m){
    --- End diff --
    
    [QueryBuilder](https://github.com/apache/deltaspike/blob/master/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/builder/QueryBuilder.java#L64) also only checks for java.util.List


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] deltaspike pull request #52: [DELTASPIKE-1160] Enable other Entity types as ...

Posted by johnament <gi...@git.apache.org>.
Github user johnament commented on a diff in the pull request:

    https://github.com/apache/deltaspike/pull/52#discussion_r65524383
  
    --- Diff: deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/builder/AnnotatedQueryBuilder.java ---
    @@ -88,4 +83,12 @@ else if (query.isNative())
             return context.applyRestrictions(result);
         }
     
    +    private Class<?> getMethodResultEntityClass(Method m){
    --- End diff --
    
    HI Danny, good catch, thats what happens when I'm looking at this too late in the evening.
    
    Can you please commit this all under the original ticket?  and can you expand this method to check for collection types?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] deltaspike pull request #52: [DELTASPIKE-1160] Enable other Entity types as ...

Posted by johnament <gi...@git.apache.org>.
Github user johnament commented on a diff in the pull request:

    https://github.com/apache/deltaspike/pull/52#discussion_r65538667
  
    --- Diff: deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/builder/AnnotatedQueryBuilder.java ---
    @@ -88,4 +83,12 @@ else if (query.isNative())
             return context.applyRestrictions(result);
         }
     
    +    private Class<?> getMethodResultEntityClass(Method m){
    --- End diff --
    
    Either is fine, your commit message doesn't include a JIRA ticket.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] deltaspike pull request #52: [DELTASPIKE-1160] Enable other Entity types as ...

Posted by Danny02 <gi...@git.apache.org>.
Github user Danny02 commented on a diff in the pull request:

    https://github.com/apache/deltaspike/pull/52#discussion_r65524755
  
    --- Diff: deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/builder/AnnotatedQueryBuilder.java ---
    @@ -88,4 +83,12 @@ else if (query.isNative())
             return context.applyRestrictions(result);
         }
     
    +    private Class<?> getMethodResultEntityClass(Method m){
    --- End diff --
    
    sry, but which original ticket do you mean? [DELTASPIKE-1089](https://issues.apache.org/jira/browse/DELTASPIKE-1089)?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] deltaspike pull request #52: [DELTASPIKE-1160] Enable other Entity types as ...

Posted by Danny02 <gi...@git.apache.org>.
Github user Danny02 commented on a diff in the pull request:

    https://github.com/apache/deltaspike/pull/52#discussion_r65539505
  
    --- Diff: deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/builder/AnnotatedQueryBuilder.java ---
    @@ -88,4 +83,12 @@ else if (query.isNative())
             return context.applyRestrictions(result);
         }
     
    +    private Class<?> getMethodResultEntityClass(Method m){
    --- End diff --
    
    done


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] deltaspike pull request #52: [DELTASPIKE-1160] Enable other Entity types as ...

Posted by johnament <gi...@git.apache.org>.
Github user johnament commented on a diff in the pull request:

    https://github.com/apache/deltaspike/pull/52#discussion_r65732553
  
    --- Diff: deltaspike/modules/data/api/src/main/java/org/apache/deltaspike/data/api/Query.java ---
    @@ -83,7 +82,11 @@
         /**
          * For native queries only, whether or not this query returns the defined entity class or not.
          * Due to type erasure from generics, we don't have runtime information about the return collection
    +     *
    +     * @deprecated Native queries can deduce the correct return type and mapping. This property has no effect and can be
    +     *             removed safely.
          */
    +    @Deprecated
         boolean returnsEntity() default true;
    --- End diff --
    
    Please delete this parameter, just like in your original PR.  This was only added this week to address this problem originally.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] deltaspike pull request #52: [DELTASPIKE-1160] Enable other Entity types as ...

Posted by Danny02 <gi...@git.apache.org>.
Github user Danny02 closed the pull request at:

    https://github.com/apache/deltaspike/pull/52


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---