You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by Denis Magda <dm...@apache.org> on 2019/11/02 02:48:33 UTC

Re: Spring Data native Query support

It’s possible to pass an Ignite native query to a method but you might need
to configure the repository differently. Please check this documentation:

https://apacheignite-mix.readme.io/docs/spring-data

Denis

On Wednesday, October 30, 2019, niamin <au...@hotmail.com> wrote:

> Does Ignite provide native Query support using Spring Data? I am not able
> to
> bootstrap my application when I configure my Repository to include a method
> that implements a native query as below:
>
> @Repository
> @RepositoryConfig(cacheName = "FOO")
> public interface ARInvoiceRepository
>         extends IgniteRepository<ARInvoice, ARInvoiceId> {
>     @Query(value = "SELECT * FROM AR_INVOICE i where i.customerId =
> :customerId " +
>             "and i.installmentFl = 'N' and i.excludeFromArFl = 'N' and
> ((i.installmentNo > 0 " +
>             "and i.installmentStartDt <= :toDate) or i.tranDt <= :toDate)
> and i.status != 'H' ",
>             nativeQuery = true)
>     List<ARInvoice> getInvoicesForOIStatement(@Param("customerId") String
> customerId, @Param("toDate") Date statementDate);
> }
>
> When I start my application I get an error as below:
>
> Caused by: java.lang.IllegalArgumentException: Not a managed type: class
> com.gpc.rpm.bo.ARInvoice
>         at
> org.hibernate.metamodel.internal.MetamodelImpl.managedType(MetamodelImpl.
> java:473)
> ~[hibernate-core-5.2.17.Final.jar:5.2.17.Final]
>         at
> org.springframework.data.jpa.repository.support.
> JpaMetamodelEntityInformation.<init>(JpaMetamodelEntityInformation.
> java:73)
> ~[spring-data-jpa-2.0.9.RELEASE.jar:2.0.9.RELEASE]
>         at
> org.springframework.data.jpa.repository.support.
> JpaEntityInformationSupport.getEntityInformation(
> JpaEntityInformationSupport.java:66)
> ~[spring-data-jpa-2.0.9.RELEASE.jar:2.0.9.RELEASE]
>         at
> org.springframework.data.jpa.repository.support.JpaRepositoryFactory.
> getEntityInformation(JpaRepositoryFactory.java:180)
> ~[spring-data-jpa-2.0.9.RELEASE.jar:2.0.9.RELEASE]
>         at
> org.springframework.data.jpa.repository.support.JpaRepositoryFactory.
> getTargetRepository(JpaRepositoryFactory.java:118)
> ~[spring-data-jpa-2.0.9.RELEASE.jar:2.0.9.RELEASE]
>         at
> org.springframework.data.jpa.repository.support.JpaRepositoryFactory.
> getTargetRepository(JpaRepositoryFactory.java:101)
> ~[spring-data-jpa-2.0.9.RELEASE.jar:2.0.9.RELEASE]
>         at
> org.springframework.data.repository.core.support.RepositoryFactorySupport.
> getRepository(RepositoryFactorySupport.java:304)
> ~[spring-data-commons-2.0.14.RELEASE.jar:2.0.14.RELEASE]
>         at
> org.springframework.data.repository.core.support.
> RepositoryFactoryBeanSupport.lambda$afterPropertiesSet$4(
> RepositoryFactoryBeanSupport.java:290)
> ~[spring-data-commons-2.0.14.RELEASE.jar:2.0.14.RELEASE]
>         at org.springframework.data.util.Lazy.getNullable(Lazy.java:141)
> ~[spring-data-commons-2.0.14.RELEASE.jar:2.0.14.RELEASE]
>         at org.springframework.data.util.Lazy.get(Lazy.java:63)
> ~[spring-data-commons-2.0.14.RELEASE.jar:2.0.14.RELEASE]
>
>
> I've added @Entity annotation to ARInvoice class but that didn't change the
> error.
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>


-- 
-
Denis