Hello I am a newbie and I hope I am posting this message to right location on this forum.
My problem is that I am developing an application and I am having trouble inserting records into the database table that I have created. The errors that I received are the following.
Hibernate: values nextval for CL05SEQ
2406 [main] ERROR org.hibernate.util.JDBCExceptionReporter - [SQL0029] INTO clause missing from embedded statement.
2406 [main] ERROR org.hibernate.util.JDBCExceptionReporter - [SQL0029] INTO clause missing from embedded statement.
2406 [main] ERROR org.hibernate.util.JDBCExceptionReporter - [SQL0029] INTO clause missing from embedded statement.
2406 [main] ERROR org.hibernate.util.JDBCExceptionReporter - [SQL0029] INTO clause missing from embedded statement.
Error Inserting Recordorg.hibernate.exception.SQLGrammarException: could not get next sequence valueI believe the reason why I am getting this error is because the auto generate functionality is now quite right for field CL05SEQ. Any help would be appreciated.
Here is my code
Main Method SnippetCode:
........................int counter = 1;
for (int temp = 0; temp < nList.getLength(); temp++) {
Node nNode = nList.item(temp);
if (nNode.getNodeType() == Node.ELEMENT_NODE) {
Element eElement = (Element) nNode;
try {
Session session = factory.openSession();
tx = session.beginTransaction();
Clh05Bean claim = new Clh05Bean();
claim.setCl05seq(counter);
counter++;
claim.setCl05clm(cl05clm); //Claim is Blank and will be Populated when Matched
claim.setCl05pid(cl05pid); //Populated from Header Section
claim.setCl05stfg(cl05stfg); //All Records are C0 when Uploaded
logger.debug("Record Type : " + getTagValue("recordType", eElement));
String cl05rty = getTagValue("recordType", eElement);
claim.setCl05rty(cl05rty);
logger.debug("Payment Type : " + getTagValue("paymentType", eElement));
String cl05pty = getTagValue("paymentType", eElement);
claim.setCl05pty(cl05pty);
logger.debug("NCPDP : " + getTagValue("ncpdp", eElement));.........................................
Clm05Bean.htm.xmlCode:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="Clh05Bean" schema="p2dtalib" table="clh05">
<id name="cl05seq" column="CL05SEQ" type="int">
<generator class="sequence">
<param name="sequence">CL05SEQ</param>
</generator>
</id>
<property name="cl05tax" type="long" column="CL05TAX" length="9" />
<property name="cl05ref" type="string" column="CL05REF"/>
<property name="cl05dos" type="long" column="CL05DOS" length="8" />
<property name="cl05car" type="string" column="CL05CAR"/>
<property name="cl05amt2" type="double" column="CL05AMT2" length="9" />
<property name="cl05amt4" type="double" column="CL05AMT4" length="9" />
<property name="cl05fil" type="long" column="CL05FIL"/>
<property name="cl05clm" type="long" column="CL05CLM"/>
<property name="cl05rty" type="string" column="CL05RTY"/>
<property name="cl05pty" type="string" column="CL05PTY"/>
<property name="cl05cnpi" type="long" column="CL05CNPI"/>
<property name="cl05dph" type="double" column="CL05DPH" length="15" />
<property name="cl05dce" type="double" column="CL05DCE" length="15" />
<property name="cl05app" type="double" column="CL05APP" length="15" />
<property name="cl05apc" type="double" column="CL05APC" length="15" />
<property name="cl05mpa" type="double" column="CL05MPA" length="15" />
<property name="cl05dpc" type="long" column="CL05DPC" length="8" />
<property name="cl05rdd" type="long" column="CL05RDD" length="8" />
<property name="cl05rdt" type="string" column="CL05RDT"/>
<property name="cl05rdu" type="string" column="CL05RDU"/>
<property name="cl05rndc" type="long" column="CL05RNDC"/>
<property name="cl05pid" type="long" column="CL05PID"/>
<property name="cl05pci" type="long" column="CL05PCI"/>
<property name="cl05cap" type="long" column="CL05CAP" length="8" />
<property name="cl05pdt" type="long" column="CL05PDT" length="8" />
<property name="cl05stfg" type="string" column="CL05STFG"/>
<property name="cl05aph" type="double" column="CL05APH" length="15" />
<property name="cl05adc" type="double" column="CL05ADC" length="15" />
<property name="cl05adp" type="double" column="CL05ADP" length="15" />
<property name="cl05adt" type="double" column="CL05ADT" length="15" />
<property name="cl05adu" type="double" column="CL05ADU" length="15" />
<property name="cl05adr" type="string" column="CL05ADR"/>
<property name="cl05adte" type="long" column="CL05ADTE" length="8" />
<property name="cl05cdt" type="long" column="CL05CDT" length="8" />
<property name="cl05ctm" type="long" column="CL05CTM"/>
<property name="cl05cus" type="string" column="CL05CUS"/>
</class>
</hibernate-mapping>
hibernate.cfg.xmlCode:
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">com.ibm.as400.access.AS400JDBCDriver</property>
<property name="hibernate.connection.url">jdbc:as400://URL</property>
<property name="hibernate.connection.username">username</property>
<property name="hibernate.connection.password">password</property>
<property name="hibernate.connection.pool_size">1</property>
<property name="connection.schema">P2DTALIB</property>
<property name="show_sql">true</property>
<property name="dialect">org.hibernate.dialect.DB2400Dialect</property>
<!-- property name="hibernate.hbm2ddl.auto">update</property-->
<!-- Mapping files -->
<mapping resource="Clh05Bean.hbm.xml"/>
<mapping resource="Pvm01Bean.hbm.xml"/>
</session-factory>
</hibernate-configuration>
Again if anyone could help me out I would be appreciate it.
Thanks