hibernate SQL 0913正在使用架构类型 *FILE中的行或对象表

xeufq47z  于 2023-11-21  发布在  其他
关注(0)|答案(1)|浏览(131)

我有一个使用spring数据的事务,我正在尝试执行保存操作(插入操作)。[SQL 0913]模式类型 *FILE中的行或对象表正在使用。
以下是实体

@Entity
@IdClass(OsytxlId.class)
@Table(name="OSYTXL")
@NamedQuery(name="Osytxl.findAll", query="SELECT o FROM Osytxl o")
public class Osytxl implements Serializable {
    private static final long serialVersionUID = 1L;

    @Id
    @Column(name="TLCONO")
    private BigDecimal tlcono;

    @Id
    @Column(name="TLDIVI")
    private String tldivi;

    @Id
    @Column(name="TLLINO")
    private BigDecimal tllino;

    @Column(name="TLLMTS")
    private BigDecimal tllmts;

    @Id
    @Column(name="TLLNCD")
    private String tllncd;

    @Column(name="TLTX60")
    private String tltx60;

    @Id
    @Column(name="TLTXID")
    private BigDecimal tltxid;

    @Id
    @Column(name="TLTXVR")
    private String tltxvr;

    //getter and setters

}

字符串
我使用的是springdata-jpa,我从service implementation类调用了下面的代码部分在下面的插入之前,我需要在插入之前删除内容。

Osytxl osytxl = null;
            Collection<Osytxl> osytxlList = new ArrayList<Osytxl>();
            for (int lineNo = 0; lineNo < lines.length; lineNo++) {
                osytxl = new Osytxl();
                osytxl.setTlcono(osytxh.getThcono());
                osytxl.setTldivi(osytxh.getThdivi());
                osytxl.setTltxid(osytxh.getThtxid());
                osytxl.setTltxvr(osytxh.getThtxvr());
                osytxl.setTllncd(osytxh.getThlncd());
                osytxl.setTllmts(new BigDecimal("1437651510403"));
                osytxl.setTllino(new BigDecimal(lineNo+1));
                osytxl.setTltx60(lines[lineNo]);
                osytxlList.add(osytxl);
            }
            if(osytxlList.size()>0)
                osytxlRepository.save(osytxlList);


我正在使用JPA存储库,但我得到了以下异常

org.springframework.orm.jpa.JpaSystemException: org.hibernate.exception.GenericJDBCException: could not execute statement; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: could not execute statement
at org.springframework.orm.jpa.EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(EntityManagerFactoryUtils.java:415)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.translateExceptionIfPossible(AbstractEntityManagerFactoryBean.java:418)
at org.springframework.dao.support.ChainedPersistenceExceptionTranslator.translateExceptionIfPossible(ChainedPersistenceExceptionTranslator.java:59)
at org.springframework.dao.support.DataAccessUtils.translateIfNecessary(DataAccessUtils.java:213)
at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:147)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodIntercceptor.invoke(CrudMethodMetadataPostProcessor.java:122)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
at com.sun.proxy.$Proxy107.saveAndFlush(Unknown Source)

........................................................


Caused by: java.sql.SQLException: [SQL0913] Row or object OSYTXL in schema type *FILE in use.
at com.ibm.as400.access.JDError.createSQLExceptionSubClass(JDError.java:877)
at com.ibm.as400.access.JDError.throwSQLException(JDError.java:706)
at com.ibm.as400.access.JDError.throwSQLException(JDError.java:676)
at com.ibm.as400.access.AS400JDBCStatement.commonExecute(AS400JDBCStatement.java:1021)
at com.ibm.as400.access.AS400JDBCPreparedStatement.executeUpdate(AS400JDBCPreparedStatement.java:1825)
at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:208)
... 127 more


我使用的是iseries(DB2)。我是否缺少了什么东西,或者我需要在persistence.xml中做一些额外的事情。有人能帮忙吗?

z5btuh9x

z5btuh9x1#

我在Experts Exchange上发现,这可能是由于应用程序外部的查询锁定了所需的记录。
添加FOR READ ONLY到您的查询中,如下所示:

SELECT * FROM FILE.TABLE
FOR READ ONLY

字符串

相关问题