Uploaded image for project: 'DeltaSpike'
  1. DeltaSpike
  2. DELTASPIKE-1160

Not possible to select non Entity or other Entity object via Native query

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 0.6, 0.7, 1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.1.0, 1.2.0, 1.2.1, 1.3.0, 1.4.0, 1.4.1, 1.4.2, 1.5.0, 1.5.1, 1.5.2, 1.5.3, 1.5.4, 1.6.0, 1.6.1
    • 1.7.0
    • Data-Module
    • None

    Description

      DELTASPIKE-1089 enabled to return none mapped types from a native query from a Repository.

      This was done with an extra flag on the Query annotation.

      The default for native Queries in Repositories is to return the entity type fo the repository.

      It should be possible to return other entity types from queries of the same repository.

      e.g.

      interface FooRepository extends EntityRepository<Foo, Long>
      {
        @Query(isNative = true,value = "SELECT  Bar.* FROM Foo JOIN Bar ON Foo.bar_fk = Bar.pk WHERE Foo.pk = ?1")
        Bar getBarFromFooByPk(long fooPk);
      
        @Query(isNative = true,value = "SELECT  Bar.* FROM Foo JOIN Bar ON Foo.bar_fk = Bar.pk WHERE Foo.age = ?1")
        List<Bar> getBarFromFooWithAge(int age);
      }
      

      Attachments

        Issue Links

          Activity

            People

              DannyNullZwo Daniel Heinrich
              DannyNullZwo Daniel Heinrich
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - 1h
                  1h
                  Remaining:
                  Remaining Estimate - 1h
                  1h
                  Logged:
                  Time Spent - Not Specified
                  Not Specified