Jpa 未创建具有布尔字段的实体的表
我尝试将GlassFish4中的连接池从MySQL切换到Derby。我将Spring数据JPA与JPA/Hibernate一起使用。问题是并非所有表都是使用derby池创建的。不创建至少有一个布尔字段的实体的表 我在日志文件中找不到任何内容:( My applicationContext.xml:Jpa 未创建具有布尔字段的实体的表,jpa,derby,glassfish-4,Jpa,Derby,Glassfish 4,我尝试将GlassFish4中的连接池从MySQL切换到Derby。我将Spring数据JPA与JPA/Hibernate一起使用。问题是并非所有表都是使用derby池创建的。不创建至少有一个布尔字段的实体的表 我在日志文件中找不到任何内容:( My applicationContext.xml: <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2
<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>
如果问题只是创建布尔列,请尝试使用@Column将DDL语句添加到Derby数据库中,我知道这会降低可移植性,但会解决问题。该属性名为columnDefinition
另外,我认为日志中需要一些内容,尝试增加日志级别。好的,我找到了解决方案:我连接到derby数据库并执行命令
values syscs\u util.syscs\u get\u database\u属性('DataDictionaryVersion');
结果是10.1,但是版本10.7对于布尔支持是必需的。然后我在GlassFish内部的derby池中重命名了数据库名称(默认情况下,它是sun appserv示例
)现在所有的表都被创建了。在新的数据库中,命令为我提供了版本10.9。Boolean是Derby的一个相对较新的添加项。也许您的Derby副本有点太旧了,或者Hibernate的Derby适配器的副本有点太旧了?