首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用Hibernate加载社区Infobright数据

使用Hibernate加载社区Infobright数据
EN

Stack Overflow用户
提问于 2015-03-30 21:31:43
回答 1查看 114关注 0票数 0

Infobright数据库社区版本不实现SQL Insert语句。相反,它使用其他语句进行数据加载。请参阅以下链接:

https://support.infobright.com/forums/showthread.php?7939-insert-in-table

因此,hibernate不能将数据保存到infobright数据库,因为hibernate使用insert状态。

代码语言:javascript
复制
Hibernate: insert into Desenvolvedor (Cidade, Estado, Nome) values (?, ?, ?)
org.hibernate.exception.GenericJDBCException: could not execute statement
at org.hibernate.exception.internal.StandardSQLExcept ionConverter.convert(StandardSQLExceptionConverter .java:54)
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.c onvert(SqlExceptionHelper.java:126)
...
Caused by: java.sql.SQLException: Table storage engine for 'desenvolvedor' doesn't have this option
at com.mysql.jdbc.SQLError.createSQLException(SQLErro r.java:1086)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.ja va:4237)
...

下面是hibernate.cfg.xml文件:

代码语言:javascript
复制
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
  <!-- Database connection properties - Driver, URL, user, password -->
  <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
  <property name="hibernate.connection.password">test</property>
  <property name="hibernate.connection.url">jdbc:mysql://10.61.15.117:5029/test</property>
  <property name="hibernate.connection.username">TestUser</property>
  <!-- Outputs the SQL queries, should be disabled in Production -->
  <property name="hibernate.show_sql">true</property>
  <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
  <property name="hibernate.connection.pool_size">1</property>
  <mapping class="base.Desenvolvedor"/>
</session-factory>
</hibernate-configuration>

已经有人面临这个问题了吗?是否真的有必要使用Hibernate createSQLQuery()方法或直接使用JDBC来实现Community Infobright数据库的数据插入?

谢谢,

Canicali

EN

回答 1

Stack Overflow用户

发布于 2015-03-31 21:28:57

采用的解决方案是将表格引擎从BRIGHTOUSE改为MYISAM。最后一个接受hibernate生成的insert命令。在SQL Create Table语句中,可以在不更改数据库引擎默认值的情况下设置表的引擎。

代码语言:javascript
复制
create table test.Desenvolvedor (
    nome varchar(11),
    cidade varchar (255),
    estado varchar (255)
) engine = MYISAM
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/29347561

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档