Java 为什么Hibernate说BIGINT是无效的数据类型?

Java 为什么Hibernate说BIGINT是无效的数据类型?,java,spring,hibernate,Java,Spring,Hibernate,我正在使用HibernateSessionFactory和自动表创建选项,但是当我想启动Tomcat时,数据库没有启动,控制台中会出现以下错误消息: 2015-10-14 23:07:26调试SQL:104-创建表教师(ID bigint not null,firstName varchar(255),lastName varchar(255), 主键(ID),唯一(ID)) 2015-10-14 23:07:26错误模式导出:426-HH000389:未成功:创建表教师(ID bigint非n

我正在使用Hibernate
SessionFactory
和自动表创建选项,但是当我想启动Tomcat时,数据库没有启动,控制台中会出现以下错误消息:

2015-10-14 23:07:26调试SQL:104-创建表教师(ID bigint not null,firstName varchar(255),lastName varchar(255), 主键(ID),唯一(ID))

2015-10-14 23:07:26错误模式导出:426-HH000389:未成功:创建表教师(ID bigint非null,firstName) varchar(255),lastName varchar(255),主键(ID),唯一(ID))

2015-10-14 23:07:26错误模式导出:427-ORA-00902:无效数据类型

这是我的配置:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation=
      "http://www.springframework.org/schema/beans
       http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
       http://www.springframework.org/schema/context
       http://www.springframework.org/schema/context/spring-context-3.0.xsd
       http://www.springframework.org/schema/tx
       http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">

    <context:component-scan base-package="com.sante.gestion" />
    <context:annotation-config />
    <context:spring-configured />

    <!-- DataSource -->
    <bean id="dataSource"
        class="org.springframework.jdbc.datasource.DriverManagerDataSource">
        <property name="driverClassName" value="oracle.jdbc.OracleDriver" />
        <property name="url" value="jdbc:oracle:thin:@localhost:1521:XE" />
        <property name="username" value="gestion" />
        <property name="password" value="gestion" />
    </bean>

    <!-- Session Factory Declaration -->
    <bean id="sessionFactory"
        class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
        <property name="dataSource" ref="dataSource" />
        <property name="packagesToScan">
            <list>
                <value>com.sante.gestion.model</value>
            </list>
        </property>
        <property name="hibernateProperties">
            <props>
                <prop key="hibernate.dialect">org.hibernate.dialect.HSQLDialect</prop>
                <prop key="hibernate.current_session_context_class">thread</prop>
                <prop key="hibernate.hbm2ddl.auto">create</prop>
            </props>
        </property>
    </bean>

    <!-- Transaction Manager is defined -->
    <bean id="txManager"
        class="org.springframework.orm.hibernate4.HibernateTransactionManager">
        <property name="sessionFactory" ref="sessionFactory" />
    </bean>
    <!-- Enable the configuration of transactional behavior based on annotations -->
    <tx:annotation-driven transaction-manager="txManager" />

</beans>

您的配置有这样一行:
org.hibernate.dialent.hsqldatalent
,但我认为您需要Oracle方言,不是吗?您的对象模型代码用于
课程
实体,但错误消息指的是
教师
表/实体。看起来您的根本问题发生在不同的域对象中,您可能对错误消息感到困惑(我们都犯了相同的错误)。如果您查看您的
教师
实体,您可能会发现问题所在。或者,您可以在您的帖子中添加有关
教师
实体的更多详细信息,因为如果没有这些额外的详细信息,我们将无法帮助您。
@Entity(name = "COURSE")
public class Course implements Serializable {
    private static final long serialVersionUID = 8736444902161357518L;

    @Id
    @Basic(optional = false)
    @Column(name = "ID", unique = true, nullable = false)
    @GeneratedValue(strategy = GenerationType.SEQUENCE,
                        generator = "COURSE_SEQ")
    @SequenceGenerator(name = "COURSE_SEQ",
                          sequenceName = "COURSE_SEQ",
                              initialValue = 1,
                                  allocationSize = 999999999)
    @Type(type = "java.lang.Long")
    private Long id;
    @Column
    private String name;