0

I have a simple spring data repository which extends CrudRepository

Also I configured

<context:component-scan base-package="by.acme.vt.*"/>

and

 <bean id="entityManagerFactory"
          class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
        <property name="dataSource" ref="eqDataSource"/>
        <property name="jpaVendorAdapter" ref="jpaVendorAdapter"/>
        <!-- Set JPA properties -->
        <property name="jpaProperties">
            <props>
                <prop key="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</prop>
                <prop key="javax.persistence.schema-generation.database.action">none</prop>
            </props>
        </property>
        <!-- Set base package of your entities -->
        <property name="packagesToScan">
            <array>
                <value>by.acme.vt.asdint</value>
                <value>by.acme.vt.asd.domain</value>
                <value>by.acme.vt.asd.repository</value>
            </array>
        </property>
    </bean>

and

<jpa:repositories base-package="by.acme.vt.*" entity-manager-factory-ref="entityManagerFactory"/>

So

by.acme.vt.asdint

belongs to the project which I am working on but packages

 <value>by.acme.vt.asd.domain</value>
 <value>by.acme.vt.asd.repository</value>

belongs to the included jar file If I create the same repo in the project, it works fine but for repositories which were included in jar, even when I run a simple code like

myrepo.findById(id)

It sends a pure HQL to the server, so it does not transform it to SQL at all.

I see response from mssql like.

table MyUser does not exist on server.

But it supposed to use my_user table but not MyUser

avalon
  • 2,231
  • 3
  • 24
  • 49

0 Answers0