导致ORA-01438的JPA序列生成器:对于Id列的此列,允许的值大于指定的精度

时间:2014-01-03 08:33:54

标签: java sql hibernate jpa

我正在使用序列生成器(long long)来生成序列。但它会抛出“ORA-01438:大于此列允许的指定精度的值”。当我从我的Entity类中删除序列生成器注释时,它可以正常使用硬编码的用户ID。注意:不同列的所有其他值保持不变。

[1/3/14 12:04:41:886 IST] 00000033 SystemOut     O Hibernate: select              FACILITY_MAPPING_SEQ.nextval from dual
[1/3/14 12:04:42:194 IST] 00000033 SystemOut     O Hibernate: insert into FACILITY_MAPPING (ACCESS_SYSTEM_LOCATION_NAME, CD_HOME_LOCATION_NAME, CREATED_BY, CREATION_DATE, DEPARTMENT_ID, FACILITY_ID, SYSTEM_TGAD, UPDATE_DATE, UPDATED_BY, FACILITY_MAPPING_PK) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
[1/3/14 12:04:42:115 IST] 00000033 SystemErr     R 6348489 [WebContainer : 3] INFO org.apache.bval.jsr303.ConfigurationImpl - ignoreXmlConfiguration == true
[1/3/14 12:04:42:874 IST] 00000033 JDBCException W org.hibernate.util.JDBCExceptionReporter logExceptions SQL Error: 1438, SQLState: 22003
[1/3/14 12:04:42:887 IST] 00000033 JDBCException E org.hibernate.util.JDBCExceptionReporter logExceptions ORA-01438: value larger than specified precision allowed for this column
[1/3/14 12:04:42:887 IST] 00000033 JDBCException W org.hibernate.util.JDBCExceptionReporter logExceptions SQL Error: 1438, SQLState: 22003
[1/3/14 12:04:42:888 IST] 00000033 JDBCException E org.hibernate.util.JDBCExceptionReporter logExceptions ORA-01438: value larger than specified precision allowed for this column
[1/3/14 12:04:42:899 IST] 00000033 RegisteredSyn E   WTRN0074E: Exception caught from before_completion synchronization operation: javax.persistence.PersistenceException: org.hibernate.exception.DataException: Could not execute JDBC batch update
    at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1387)
    at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1315)
    at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1321)
    at org.hibernate.ejb.AbstractEntityManagerImpl$3.mapManagedFlushFailure(AbstractEntityManagerImpl.java:1235)
    at org.hibernate.transaction.synchronization.CallbackCoordinator.beforeCompletion(CallbackCoordinator.java:122)
    at org.hibernate.transaction.synchronization.HibernateSynchronizationImpl.beforeCompletion(HibernateSynchronizationImpl.java:51)
    at com.ibm.tx.jta.impl.RegisteredSyncs.coreDistributeBefore(RegisteredSyncs.java:291)
    at com.ibm.ws.tx.jta.RegisteredSyncs.distributeBefore(RegisteredSyncs.java:152)
    at com.ibm.ws.tx.jta.TransactionImpl.prePrepare(TransactionImpl.java:2338)
    at com.ibm.ws.tx.jta.TransactionImpl.stage1CommitProcessing(TransactionImpl.java:557)
    at com.ibm.tx.jta.impl.TransactionImpl.processCommit(TransactionImpl.java:1015)
    at com.ibm.tx.jta.impl.TransactionImpl.commit(TransactionImpl.java:949)
    at com.ibm.ws.tx.jta.TranManagerImpl.commit(TranManagerImpl.java:438)
    at com.ibm.tx.jta.impl.TranManagerSet.commit(TranManagerSet.java:181)
    at com.ibm.ejs.csi.TranStrategy.commit(TranStrategy.java:950)
    at com.ibm.ejs.csi.TranStrategy.postInvoke(TranStrategy.java:265)
    at com.ibm.ejs.csi.TransactionControlImpl.postInvoke(TransactionControlImpl.java:579)
    at com.ibm.ejs.container.EJSContainer.postInvoke(EJSContainer.java:4873)
    at com.swissre.bae.shared.services.EJSLocal0SLAddNewFacilityServiceImpl_0f22d836.getUpdateAddNewFacility(EJSLocal0SLAddNewFacilityServiceImpl_0f22d836.java)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
    at java.lang.reflect.Method.invoke(Method.java:611)
    at org.apache.webbeans.ejb.common.proxy.EjbBeanProxyHandler.invoke(EjbBeanProxyHandler.java:204)
    at org.javassist.tmp.java.io.Serializable_$$_javassist_18.getUpdateAddNewFacility(Serializable_$$_javassist_18.java)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
    at java.lang.reflect.Method.invoke(Method.java:611)
    at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:569)
    at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:551)
    at com.swissre.bae.server.rpc.BAEController.processCall(BAEController.java:54)
    at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:248)
    at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:595)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1224)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:774)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:456)
    at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
    at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1032)
    at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3751)
    at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:304)
    at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:962)
    at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1662)
    at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:195)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:452)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:511)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:305)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:276)
    at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
    at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
    at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
    at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
    at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
    at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
    at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
    at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
    at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1690)
Caused by: org.hibernate.exception.DataException: Could not execute JDBC batch update
    at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:102)
    at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
    at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:275)
    at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:268)
    at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:184)
    at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
    at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:51)
    at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1216)
    at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:383)
    at org.hibernate.transaction.synchronization.CallbackCoordinator.beforeCompletion(CallbackCoordinator.java:117)
    ... 55 more
Caused by: java.sql.BatchUpdateException: ORA-01438: value larger than specified precision allowed for this column

我的FacilityMapping课程:

@Entity
@Table(name = "FACILITY_MAPPING")
public class FacilityMapping implements Serializable{

    private static final long serialVersionUID = 1977735642805030781L;

    @Id
    @GeneratedValue(strategy =GenerationType.SEQUENCE, generator = "FACILITYMAPPINGPKSEQ")
    @SequenceGenerator(name="FACILITYMAPPINGPKSEQ", sequenceName = "FACILITY_MAPPING_SEQ")
    @Column(name="FACILITY_MAPPING_PK")
    private long faciltiyMappingPk;

    @Column(name="SYSTEM_TGAD")
    private String systemTGAD;

    @Column(name="CD_HOME_LOCATION_NAME")
    private String cdHomeLocationName;

    @Column(name="ACCESS_SYSTEM_LOCATION_NAME")
    private String accSysLocName;

    @Column(name="FACILITY_ID")
    private long facilityId;

    @Column(name="DEPARTMENT_ID")
    private long departmentId;

    @Column (name="CREATION_DATE")
    private Date creationDate;

    @Column (name="UPDATE_DATE")
    private Date updateDate;

    @Column (name="CREATED_BY")
    private String createdBy;

    @Column (name="UPDATED_BY")
    private String updatedBy;

    public long getFaciltiyMappingPk() {
        return faciltiyMappingPk;
    }

    public void setFaciltiyMappingPk(long faciltiyMappingPk) {
        this.faciltiyMappingPk = faciltiyMappingPk;
    }

    public String getSystemTGAD() {
        return systemTGAD;
    }

    public void setSystemTGAD(String systemTGAD) {
        this.systemTGAD = systemTGAD;
    }

    public String getCdHomeLocationName() {
        return cdHomeLocationName;
    }

    public void setCdHomeLocationName(String cdHomeLocationName) {
        this.cdHomeLocationName = cdHomeLocationName;
    }

    public String getAccSysLocName() {
        return accSysLocName;
    }

    public void setAccSysLocName(String accSysLocName) {
        this.accSysLocName = accSysLocName;
    }

    public long getFacilityId() {
        return facilityId;
    }

    public void setFacilityId(long facilityId) {
        this.facilityId = facilityId;
    }

    public long getDepartmentId() {
        return departmentId;
    }

    public void setDepartmentId(long departmentId) {
        this.departmentId = departmentId;
    }



    public Date getCreationDate() {
        return creationDate;
    }

    public void setCreationDate(Date creationDate) {
        this.creationDate = creationDate;
    }

    public Date getUpdateDate() {
        return updateDate;
    }

    public void setUpdateDate(Date updateDate) {
        this.updateDate = updateDate;
    }

    public String getCreatedBy() {
        return createdBy;
    }

    public void setCreatedBy(String createdBy) {
        this.createdBy = createdBy;
    }

    public String getUpdatedBy() {
        return updatedBy;
    }

    public void setUpdatedBy(String updatedBy) {
        this.updatedBy = updatedBy;
    }
}

请提供一些帮助

先谢谢

1 个答案:

答案 0 :(得分:0)

通过异常的堆栈跟踪,您的任何插入值都高于DB列上定义的精度。

最有可能的是,序列会产生价值。只需检查序列生成的下一个值,并将a / c大小增加到该值。