Hi guys, any ideas what could be the problem?
ERROR [main] (JDBCExceptionReporter.java:46) - A syntax error has occurred.
ERROR [main] (JDBCExceptionReporter.java:46) - A syntax error has occurred.
ERROR [main] (JDBCException.java:38) - could not insert: [cz.aura.isl.katalog.davky.domain.ZpravaKatalogu]
java.sql.SQLException: A syntax error has occurred.
at com.informix.util.IfxErrMsg.getSQLException(IfxErrMsg.java:355)
at com.informix.jdbc.IfxSqli.addException(IfxSqli.java:3086)
at com.informix.jdbc.IfxSqli.receiveError(IfxSqli.java:3396)
at com.informix.jdbc.IfxSqli.dispatchMsg(IfxSqli.java:2259)
at com.informix.jdbc.IfxSqli.receiveMessage(IfxSqli.java:2179)
at com.informix.jdbc.IfxSqli.executePrepare(IfxSqli.java:1082)
at com.informix.jdbc.IfxResultSet.executePrepare(IfxResultSet.java:182)
at com.informix.jdbc.IfxPreparedStatement.setupExecutePrepare(IfxPreparedStatement.java:197)
at com.informix.jdbc.IfxPreparedStatement.<init>(IfxPreparedStatement.java:175)
at com.informix.jdbc.IfxSqliConnect.prepareStatement(IfxSqliConnect.java:1907)
at org.apache.commons.dbcp.DelegatingConnection.prepareStatement(DelegatingConnection.java:216)
at org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.prepareStatement(PoolingDataSource.java:323)
at net.sf.hibernate.impl.BatcherImpl.getPreparedStatement(BatcherImpl.java:249)
at net.sf.hibernate.impl.BatcherImpl.prepareStatement(BatcherImpl.java:61)
at net.sf.hibernate.impl.BatcherImpl.prepareStatement(BatcherImpl.java:56)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:540)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:432)
at net.sf.hibernate.impl.ScheduledIdentityInsertion.execute(ScheduledIdentityInsertion.java:29)
at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:925)
at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:850)
at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:768)
at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:731)
at org.springframework.orm.hibernate.HibernateTemplate$8.doInHibernate(HibernateTemplate.java:242)
at org.springframework.orm.hibernate.HibernateTemplate.execute(HibernateTemplate.java:150)
at org.springframework.orm.hibernate.HibernateTemplate.save(HibernateTemplate.java:240)
at cz.aura.isl.katalog.dao.hibernate.HibernateZpravaKataloguDAO.insertZpravu(HibernateZpravaKataloguDAO.java:42)
at cz.aura.isl.katalog.dao.hibernate.HibernateZpravaKataloguDAOTest.testUlozZpravu(HibernateZpravaKataloguDAOTest.java:88)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:392)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:276)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:167)
Here's my mapping file:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >
<hibernate-mapping>
<class
name="cz.aura.isl.katalog.davky.domain.ZpravaKatalogu"
table="kzprava"
>
<!-- please tell Joe Hudson that the type 'serial' could not be resolved.. defaulting to java.lang.String -->
<id
name="idZpravy"
type="java.lang.Integer"
column="id_kzprava"
>
<generator class="native"/>
</id>
<property
name="prijataOdeslana"
column="kprijod"
type="java.lang.String"
/>
<property
name="vstupniVystupni"
column="kvsvys"
type="java.lang.String"
/>
<!-- <property
name="casVytvoreniZpravy"
column="kcvytzp"
type="java.lang.String"
not-null="false"
/>
<property
name="kontrolniZpravaZasilkyKatalogu"
column="id_kkonzpz"
type="java.lang.Integer"
/>
<property
name="datumVytvoreniZpravy"
column="kdatode"
type="date"
not-null="false"
/>
<property
name="posledniZpracovanyStitek"
column="kpozpst"
type="java.lang.Integer"
not-null="false"
/>
<property
name="cisloZpravy"
column="kciszp"
type="java.lang.String"
not-null="false"
/>
<property
name="kodMOEExterni"
column="kmoeext"
type="java.lang.String"
not-null="false"
/>
<property
name="prioritaZpravy"
column="kprzpr"
type="java.lang.String"
not-null="false"
/>
<property
name="stavZpravy"
column="kkstspr"
type="java.lang.String"
not-null="false"
/>
-->
</class>
</hibernate-mapping>
and here's my sql table definition:
CREATE TABLE kzprava ( -- kzprava [K_zprava] --
id_kzprava SERIAL
kmoeext CHAR(2)
CHECK (kmoeext matches "[0-9A-Z][0-9A-Z]") CONSTRAINT ckzpravkmoeext____
,
id_kkonzpz INTEGER
,
kkstspr CHAR(1)
CHECK (kkstspr matches "[0-9]") CONSTRAINT ckzpravkkstspr____
,
kciszp CHAR(4)
CHECK (kciszp matches "[0-9][0-9][0-9][0-9]") CONSTRAINT ckzpravkciszp_____
,
kprzpr CHAR(1)
CHECK (kprzpr matches "[PR]") CONSTRAINT ckzpravkprzpr_____
,
kdatode DATE
,
kcvytzp CHAR(4)
,
kpozpst SMALLINT
,
kprijod CHAR(1)
NOT NULL CONSTRAINT nkzpravkprijod____
CHECK (kprijod matches "[PO]") CONSTRAINT ckzpravkprijod____
,
kvsvys CHAR(1)
NOT NULL CONSTRAINT nkzpravkvsvys_____
CHECK (kvsvys matches "[KLO]") CONSTRAINT ckzpravkvsvys_____
)
and here's my class:
package cz.aura.isl.katalog.davky.domain;
import java.io.Serializable;
import java.util.Collection;
import java.util.Iterator;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
public abstract class Zprava implements Serializable {
private Integer idZpravy;
private String kodMOEExterni;
private String stavZpravy;
private String cisloZpravy;
private String prijataOdeslana;
protected Collection teloZpravy;
private Stitek hlavickaZpravy;
private Stitek patickaZpravy;
public Zprava() {
}
public String getCisloZpravy() {
return cisloZpravy;
}
public Integer getIdZpravy() {
return idZpravy;
}
public String getKodMOEExterni() {
return kodMOEExterni;
}
public String getPrijataOdeslana() {
return prijataOdeslana;
}
public void setCisloZpravy(String string ) {
cisloZpravy = string;
}
public void setIdZpravy(Integer i) {
idZpravy = i;
}
public void setKodMOEExterni(String string) {
kodMOEExterni = string;
}
public void setPrijataOdeslana(String string) {
prijataOdeslana = string;
}
public Stitek getHlavickaZpravy() {
return hlavickaZpravy;
}
public Stitek getPatickaZpravy() {
return patickaZpravy;
}
public void setHlavickaZpravy(Stitek stitek) {
hlavickaZpravy = stitek;
}
public void setPatickaZpravy(Stitek stitek) {
patickaZpravy = stitek;
}
teloZpravy.add(s);
}
public Iterator getStitkyIterator() {
return teloZpravy.iterator();
}
public String toString() {
return ToStringBuilder.reflectionToString(this,ToStringStyle.MULTI_LINE_STYLE);
}
public String getStavZpravy() {
return stavZpravy;
}
public void setStavZpravy(String string) {
stavZpravy = string;
}
}
package cz.aura.isl.katalog.davky.domain;
import java.io.Serializable;
import java.util.Collections;
import java.util.Date;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
public class ZpravaKatalogu extends Zprava
implements Serializable {
private Integer kontrolniZpravaZasilkyKatalogu;
private String prioritaZpravy;
private Date datumVytvoreniZpravy;
private String casVytvoreniZpravy;
private Integer posledniZpracovanyStitek;
private String vstupniVystupni;
public final static String hlavickaPattern= "nejaky reg. vyraz, doplnit";
public final static String p;
public ZpravaKatalogu() {
teloZpravy = Collections.synchronizedList(new LinkedList());
}
|