I am having a transaction using spring data , and I am trying to do an save operation (insert operation) . [SQL0913] Row or object table in Schema type *FILE in use.
Following is the entity
@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
}
I am using springdata-jpa And I am calling the following code portion from the service implementation class Before the following insertion , I need to delete the contents before insert .
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);
And I am using JPA repository But I am getting the following exception
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
I am using iseries (DB2) .Am I missing something or there anything I need to do extra in persistence.xml . Can anyone help .