org.hibernate.HibernateException:缺少序列或表:使用Oracle 11g的“ BPM_SEC_USER_SEQ”

时间:2018-07-09 12:05:37

标签: java spring hibernate oracle11g

我遇到以下错误:  org.hibernate.HibernateException:缺少序列或表:BPM_SEC_USER_SEQ

这里我使用的是Spring 4.3.5,Hibernate 4.3.6.Final,Oracle 11g和Java 1.8。

这里BPM_SEC_USER_SEQ是我的数据库表BPM_SEC_USER提到的定序器。

这是我的.hbm.xml文件

<hibernate-mapping>
<class name="com.i3l.finnair.bpm.dbinteraction.entity.BPMSecUser"
    table="BPM_SEC_USER" schema="BPM">
    <comment>Table to store users for the CNS portal. User will be
        associated with a role. References - CNS_SEC_ROLE</comment>
    <id name="userId" type="java.lang.Long">
        <column name="SEC_USER_ID" precision="10" scale="0" />
         <generator class="sequence-identity">
            <param name="sequence">BPM_SEC_USER_SEQ</param>
        </generator> 
    </id>
    <property name="version" type="java.lang.Long">
        <column name="VERSION" precision="10" scale="0">
            <comment>Concurrency Control</comment>
        </column>
    </property>
    <!-- <many-to-one name="bpmSecRole" class="com.i3l.finnair.bpm.admin.entity.BPMSecRole" 
        fetch="select" lazy="false"> <column name="SEC_ROLE_ID" precision="10" scale="0" 
        not-null="true"> <comment>Foreign Key - CNS_SEC_ROLE</comment> </column> 
        </many-to-one> -->
    <property name="firstName" type="string">
        <column name="FIRST_NAME" length="60">
            <comment>User First Name</comment>
        </column>
    </property>
    <property name="lastName" type="string">
        <column name="LAST_NAME" length="60">
            <comment>User Last Name</comment>
        </column>
    </property>
    <property name="emailAddress" type="string">
        <column name="EMAIL_ADDRESS" length="100">
            <comment>Email Address of the User</comment>
        </column>
    </property>
    <property name="phoneNo" type="string">
        <column name="PHONE_NO" length="20">
            <comment>Email Address of the User</comment>
        </column>
    </property>
    <property name="organization" type="string" column="ORGANIZATION">

    </property>
    <property name="loginName" type="string">
        <column name="LOGIN_NAME" length="30">
            <comment>Login Id for the user</comment>
        </column>
    </property>
    <property name="password" type="string">
        <column name="PASSWORD" length="30">
            <comment>Password stored in encrypted format</comment>
        </column>
    </property>
    <property name="active" type="java.lang.Character">
        <column name="ACTIVE" length="1">
            <comment>Record Status</comment>
        </column>
    </property>
    <property name="crtBy" type="java.lang.Long">
        <column name="CRT_BY" precision="10" scale="0">
            <comment>Record Created By - CNS_SEC_USER</comment>
        </column>
    </property>
    <property name="modBy" type="java.lang.Long">
        <column name="MOD_BY" precision="10" scale="0">
            <comment>Record Modified By - CNS_SEC_USER</comment>
        </column>
    </property>
    <property name="crtDttime" type="java.util.Calendar">
        <column name="CRT_DTTIME">
            <comment>Record Creation Date</comment>
        </column>
    </property>
    <property name="modDttime" type="java.util.Calendar">
        <column name="MOD_DTTIME">
            <comment>Record Modification Date</comment>
        </column>
    </property>
    <property name="lastLogin" type="java.util.Calendar">
        <column name="LAST_LOGIN">
            <comment>Last Login Details</comment>
        </column>
    </property>
    <property name="procErrMail" type="java.lang.Character">
        <column name="PROC_ERR_MAIL" length="1">
            <comment>Record Error Email</comment>
        </column>
    </property>

    <property name="salt" type="string">
        <column name="SALT">
            <comment>SALT Source Code</comment>
        </column>
    </property>


</class>

这是我的实体文件     公共类BPMSecUser扩展BaseEntity {

 private Long userId;
 private Long version=new Long(0);
 //private BPMSecRole bpmSecRole=new BPMSecRole();
 private String firstName;
 private String lastName;
 private String emailAddress;
 private String phoneNo;
 private String organization;
 private String loginName;
 private String password;
 private String confirmPassword;
 private Character active='Y';
 private Long crtBy;
 private Long modBy;
 private Calendar crtDttime;
 private Calendar modDttime;
 private Calendar lastLogin;
 private Character procErrMail='Y';
 private boolean procErr=true;
 private boolean loggedInUser;
 private String salt;
 private String currentPassword;

Setter吸气剂已删除,以提高可读性

现在,此生成器类的序列标识给了我上述错误。

此外,如果我使生成器类增加,但是我需要使用数据库中的Sequencer来增加我的user_id,以上代码将完美运行 请帮助。

0 个答案:

没有答案