English 中文(简体)
2. 类型 审案
原标题:Mybatis configuration with typeAliases

I m 根据Mybatis 3.0.5、Mybatis-children 1.0.1和 Spring 3.0.5,编写 Java E申请。 RELEASE and I ve found a problem using Alias in mybatis-config.xml. 追踪:

org.springframework.beans.factory.BeanCreationException:
Error creating bean with name sqlSessionFactory defined in ServletContext resource [/WEB-INF/applicationContext.xml]:
Invocation of init method failed; nested exception is org.springframework.core.NestedIOException:
Failed to parse config resource: class path resource [mybatis-config.xml]; nested exception is org.apache.ibatis.builder.BuilderException:
Error parsing SQL Mapper Configuration. Cause: org.apache.ibatis.builder.BuilderException:
Error registering typeAlias for accesoUsuario . Cause: java.lang.ClassNotFoundException:
Cannot find class: [PACKAGE OMITTED BY ME].AccesoUsuario

我如何解决这一问题?

这是我的我的施压器。

 <settings>
     <setting name="lazyLoadingEnabled" value="false" />
  </settings>

<typeAliases>
    <typeAlias alias="accesoUsuario" type="MYPACKAGE.persistencia.entidades.AccesoUsuario" />
    <typeAlias alias="agrupacion" type="MYPACKAGE.persistencia.entidades.Agrupacion" />
    <typeAlias alias="consulta" type="MYPACKAGE.persistencia.entidades.Consulta" />
    <typeAlias alias="consultaDim" type="MYPACKAGE.persistencia.entidades.ConsultaDim" />
    <typeAlias alias="consultaFiltro" type="MYPACKAGE.persistencia.entidades.ConsultaFiltro" />
    <typeAlias alias="dato" type="MYPACKAGE.persistencia.entidades.Dato" />
    <typeAlias alias="dimension" type="MYPACKAGE.persistencia.entidades.Dimension" />
            <typeAlias alias="dominio" type="MYPACKAGE.persistencia.entidades.Dominio" />
            <typeAlias alias="dominioDep" type="MYPACKAGE.persistencia.entidades.DominioDep" />
            <typeAlias alias="entidad" type="MYPACKAGE.persistencia.entidades.Entidad" />
    <typeAlias alias="error" type="MYPACKAGE.persistencia.entidades.ErrorProceso" />
    <typeAlias alias="informe" type="MYPACKAGE.persistencia.entidades.Informe" />
    <typeAlias alias="informeCabecera" type="MYPACKAGE.persistencia.entidades.InformeCabecera" />
    <typeAlias alias="informeSeccion" type="MYPACKAGE.persistencia.entidades.InformeSeccion" />
    <typeAlias alias="restriVariable" type="MYPACKAGE.persistencia.entidades.RestriVariable" />
    <typeAlias alias="usuario" type="MYPACKAGE.persistencia.entidades.Usuario" />
    <!-- ... -->
            <typeAlias alias="cadena" type="java.lang.String" />
</typeAliases>
问题回答

Without seeing some of the actual source code, I doubt we can pinpoint any errors, but it might help to take a look at this example on DZone.

他们特别指出的一件事是,如果你不遵循我方-config.xml案的正确命令,就会造成一种例外。 这或许就是说,这在档案中的错误位置上。

如果你想把这部法典放在更多的位置,我会尽力给予更多的帮助。

我的巴奇特无法得到你包裹。 你们需要用配置来界定:

<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
    <property name="basePackage" value="es.your.packacke"/>
</bean>




相关问题
array dependency injection in spring?

is there a way to use dependency injection to inject all available implementations of a specific interface in spring? This is kind of the same thing as asked here for .NET. Though my aim is to use @...

Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Grails Packaging and Naming Conventions

Packaging Controllers, Services,etc. i.e. - com.company.controllers - com.company.services Is this a good practice or should be avoided by all means?? Another worth mentioning problem I encountered ...

How can I determine Objects in application context?

I am trying to write a portlet for Liferay (using Tomcat and Spring) and need to use a database via Persistence API/Hibernate. I am using some configuration XMLs (applicationContext.xml, etc.) and ...

How to prevent JPA from rolling back transaction?

Methods invoked: 1. Struts Action 2. Service class method (annotated by @Transactional) 3. Xfire webservice call Everything including struts (DelegatingActionProxy) and transactions is configured ...

热门标签