Hi , I am getting below error while inserting data into chiled and parent table using hiberante
For Example ITEM table and CUSTOMER table having the ONE-TO -MANY relation ship
the data is inserting into Item table not inserting to CUSTOMER TABLE
please help me if any one know about it
I am using JDBC ODBC connection with Ms Access Database ;
My Dailect class is
/* * Created on Aug 18, 2009 * * TODO To change the template for this generated file go to * Window - Preferences - Java - Code Style - Code Templates */ package com.onlineshoping.domain;
import java.sql.Types;
import org.hibernate.cfg.Environment; import org.hibernate.dialect.Dialect;
/** * @author User * * TODO To change the template for this generated type comment go to * Window - Preferences - Java - Code Style - Code Templates */ public class MsAccessDialect extends Dialect {
static final String NO_BATCH = "0"; // this should be just protected in Dialect, I think
public MsAccessDialect() { super(); registerColumnType( Types.BIT, "BIT" ); // This is a synonym for BOOLEAN registerColumnType( Types.BIGINT, "BIGINT" ); // I don't think Access has these registerColumnType( Types.SMALLINT, "SMALLINT" ); registerColumnType( Types.TINYINT, "TINYINT" ); registerColumnType( Types.INTEGER, "INTEGER" ); registerColumnType(Types.CHAR,"VARCHAR(1)"); registerColumnType( Types.DOUBLE, "DOUBLE" ); registerColumnType( Types.VARCHAR, 255, "varchar($l)" ); registerColumnType( Types.FLOAT, "DOUBLE" ); registerColumnType( Types.DOUBLE, "DOUBLE" ); registerColumnType( Types.NUMERIC, "NUMERIC" ); registerColumnType( Types.DATE, "DATE" ); // synonym for DATETIME registerColumnType( Types.TIME, "TIME" ); // synonym for DATETIME registerColumnType( Types.TIMESTAMP, "TIMESTAMP" ); // synonym for DATETIME
registerColumnType( Types.VARBINARY, "VARBINARY($l)" ); // synonym for BINARY registerColumnType( Types.NUMERIC, "NUMERIC(19, $l)" ); // NUMERIC in Access takes no parameters getDefaultProperties().setProperty(Environment.STATEMENT_BATCH_SIZE, NO_BATCH); } public String getIdentitySelectString() { return "select @@IDENTITY"; } public String getIdentityColumnString() { return "not null auto_number"; } public String getForUpdateString(){ return ""; } public boolean supportsParametersInInsertSelect(){ return true; } }
Error is as shown below Aug 22, 2009 6:56:19 PM org.hibernate.type.NullableType nullSafeSet INFO: could not bind value '10' to parameter: 1; [Microsoft][ODBC Microsoft Access Driver]Optional feature not implemented Aug 22, 2009 6:56:19 PM org.hibernate.util.JDBCExceptionReporter logExceptions WARNING: SQL Error: 106, SQLState: S1C00 Aug 22, 2009 6:56:19 PM org.hibernate.util.JDBCExceptionReporter logExc
eptions SEVERE: [Microsoft][ODBC Microsoft Access Driver]Optional feature not implemented org.hibernate.exception.GenericJDBCException: could not insert: [com.onlineshoping.domain.CatalogRecord] at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103) at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43) at org.hibernate.id.insert.AbstractSelectingDelegate.performInsert(AbstractSelectingDelegate.java:40) at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2158) at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2638) at org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:48) at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:250) at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:298) at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:181) at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:107) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:187) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:172) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:94) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70) at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:507) at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:499) at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:495) at Client.Client.insertIntoCatalog(Client.java:104) at Client.Client.main(Client.java:51) Caused by: java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver]Optional feature not implemented at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6879) at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7036) at sun.jdbc.odbc.JdbcOdbc.SQLBindInParameterBigint(JdbcOdbc.java:1179) at sun.jdbc.odbc.JdbcOdbcPreparedStatement.setLong(JdbcOdbcPreparedStatement.java:592) at org.hibernate.type.LongType.set(LongType.java:42) at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:136) at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:107) at org.hibernate.persister.entity.AbstractEntityPersister.dehydrate(AbstractEntityPersister.java:1997) at org.hibernate.persister.entity.AbstractEntityPersister.dehydrate(AbstractEntityPersister.java:1974) at org.hibernate.persister.entity.AbstractEntityPersister$3.bindValues(AbstractEntityPersister.java:2152) at org.hibernate.id.insert.AbstractSelectingDelegate.performInsert(AbstractSelectingDelegate.java:32) ... 16 more
|