未创建具有布尔字段的实体的表 [英] Tables for entities with boolean fields not created

查看:83
本文介绍了未创建具有布尔字段的实体的表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图将GlassFish 4中的连接池从MySQL切换到Derby.我在JPA/Hibernate中使用Spring-Data-JPA.问题在于,并非所有表都是使用derby池创建的.没有创建具有至少一个布尔值字段的实体的表.

i tried to switch a connection pool in GlassFish 4 from MySQL to Derby. I am using Spring-Data-JPA with JPA/Hibernate. The problem is that not all tables are created with the derby pool. The tables for entities which have at least one boolean field are not created.

我在日志文件中什么都没找到. :(

I found nothing in the log files. :(

我的applicationContext.xml:

My applicationContext.xml:

<beans
    xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xmlns:jpa="http://www.springframework.org/schema/data/jpa"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
      http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa-1.1.xsd
      http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
      http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd">

    <context:annotation-config />

    <context:component-scan base-package="project" />

    <bean
        id="dataSource"
        class="org.springframework.jndi.JndiObjectFactoryBean">
        <property
            name="jndiName"
            value="serverPool" />
        <property
            name="lookupOnStartup"
            value="false" />
        <property
            name="proxyInterface"
            value="javax.sql.DataSource" />
    </bean>

    <bean
        id="hibernateJpaVendorAdapter"
        class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
        <property
            name="generateDdl"
            value="true" />
        <property
            name="showSql"
            value="true" />
    </bean>

    <bean
        id="entityManagerFactory"
        class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
        <property
            name="dataSource"
            ref="dataSource" />
        <property
            name="jpaVendorAdapter"
            ref="hibernateJpaVendorAdapter" />
        <property
            name="packagesToScan"
            value="project.model.entity" />
    </bean>

    <bean
        id="transactionManager"
        class="org.springframework.orm.jpa.JpaTransactionManager">
        <property
            name="entityManagerFactory"
            ref="entityManagerFactory" />
    </bean>
    <tx:annotation-driven transaction-manager="transactionManager" />

    <jpa:repositories base-package="project.model.repository" />
</beans>

推荐答案

好,我找到了解决方案:我连接到derby数据库并执行了命令values syscs_util.syscs_get_database_property( 'DataDictionaryVersion' );,结果为10.1,但布尔支持需要版本10.7 .然后,我在GlassFish内的derby池中重命名了数据库名称(默认为sun-appserv-samples),现在所有表都已创建.在新数据库中,该命令为我提供了10.9版.

Okay, i found the solution: I connected to the derby database and executed the command values syscs_util.syscs_get_database_property( 'DataDictionaryVersion' ); The result was 10.1, but version 10.7 is necessary for boolean support. I then renamed the database name in the derby pool inside GlassFish (its by default sun-appserv-samples) and now all tables are created. With the new database the command gave me version 10.9.

这篇关于未创建具有布尔字段的实体的表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆