Results 1 to 4 of 4
  1. #1
    Peter is offline Senior Member
    Join Date
    Jun 2007
    Posts
    119
    Rep Power
    0

    Default org.hibernate.exception.GenericJDBCException: could not insert

    Hi,

    I am new to hibernate and would like to store a image using Blob in oracle database.

    I am creating a java.sql.Blob instance using Hibernate.createBlob(InputStream in) method. But when i try to save the object into the database this error appears
    Java Code:
    org.hibernate.exception.GenericJDBCException: could not insert: [user.Product]
    at org.hibernate.exception.ErrorCodeConverter.handledNonSpecificException
    (ErrorCodeConverter.java:92)
    at org.hibernate.exception.ErrorCodeConverter.convert
    (ErrorCodeConverter.java:80)
    at org.hibernate.exception.JDBCExceptionHelper.convert
    (JDBCExceptionHelper.java:43)
    at org.hibernate.persister.BasicEntityPersister.insert
    (BasicEntityPersister.java:1683)
    at org.hibernate.persister.BasicEntityPersister.insert
    (BasicEntityPersister.java:2012)
    at org.hibernate.action.EntityInsertAction.execute
    (EntityInsertAction.java:42)
    at org.hibernate.impl.ActionQueue.executeActions
    (ActionQueue.java:232)
    at org.hibernate.impl.ActionQueue.executeActions
    (ActionQueue.java:137)
    at org.hibernate.event.AbstractFlushingEventListener.performExecutions
    (AbstractFlushingEventListener.java:255)
    at org.hibernate.event.DefaultFlushEventListener.onFlush
    (DefaultFlushEventListener.java:26)
    at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:814)
    at org.hibernate.transaction.JDBCTransaction.commit
    (JDBCTransaction.java:75)
    at oracle.jdbc.dbaccess.DBError.throwSqlException
    (DBError.java:179)
    at oracle.jdbc.driver.OraclePreparedStatement.addBatch
    (OraclePreparedStatement.java:4073)
    mmm any ideas?

  2. #2
    Ed
    Ed is offline Senior Member
    Join Date
    Jun 2007
    Posts
    110
    Rep Power
    0

    Default

    Are you mapping your blob to byte[] array?

  3. #3
    Heather is offline Senior Member
    Join Date
    Jun 2007
    Posts
    164
    Rep Power
    8

    Default

    Here that is the problem
    Dadidadida: 06/01/2005 - 07/01/2005

  4. #4
    Join Date
    Jul 2010
    Posts
    1
    Rep Power
    0

    Default Hi

    Hi, I am trying to insert xml data into database of clob type which is around 25000 characters. but when i am inserting data it is accepting only 2500 character and if it above that it is throwing an error saying,

    Can you please tell me what is the issue with this.


    org.hibernate.exception.GenericJDBCException: could not insert: [Hibernate.XmlPojo1]
    at org.hibernate.exception.ErrorCodeConverter.handled NonSpecificException(ErrorCodeConverter.java:92)
    at org.hibernate.exception.ErrorCodeConverter.convert (ErrorCodeConverter.java:80)
    at org.hibernate.exception.JDBCExceptionHelper.conver t(JDBCExceptionHelper.java:43)
    at org.hibernate.persister.entity.BasicEntityPersiste r.insert(BasicEntityPersister.java:1869)
    at org.hibernate.persister.entity.BasicEntityPersiste r.insert(BasicEntityPersister.java:2200)
    at org.hibernate.action.EntityInsertAction.execute(En tityInsertAction.java:46)
    at org.hibernate.engine.ActionQueue.execute(ActionQue ue.java:239)
    at org.hibernate.engine.ActionQueue.executeActions(Ac tionQueue.java:223)
    at org.hibernate.engine.ActionQueue.executeActions(Ac tionQueue.java:136)
    at org.hibernate.event.def.AbstractFlushingEventListe ner.performExecutions(AbstractFlushingEventListene r.java:274)
    at org.hibernate.event.def.DefaultFlushEventListener. onFlush(DefaultFlushEventListener.java:27)
    at org.hibernate.impl.SessionImpl.flush(SessionImpl.j ava:730)
    at org.hibernate.impl.SessionImpl.managedFlush(Sessio nImpl.java:324)
    at org.hibernate.transaction.JDBCTransaction.commit(J DBCTransaction.java:86)
    at Demo.Demo.main(Demo.java:109)
    Caused by: java.sql.SQLException: Data size bigger than max size for this type: 20316
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBE rror.java:114)
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBE rror.java:156)
    at oracle.jdbc.dbaccess.DBError.check_error(DBError.j ava:775)
    at oracle.jdbc.ttc7.TTCItem.setArrayData(TTCItem.java :82)
    at oracle.jdbc.driver.OraclePreparedStatement.setItem (OraclePreparedStatement.java:771)
    at oracle.jdbc.driver.OraclePreparedStatement.setStri ng(OraclePreparedStatement.java:1136)
    at org.hibernate.type.StringType.set(StringType.java: 24)
    at org.hibernate.type.NullableType.nullSafeSet(Nullab leType.java:62)
    at org.hibernate.type.NullableType.nullSafeSet(Nullab leType.java:39)
    at org.hibernate.persister.entity.BasicEntityPersiste r.dehydrate(BasicEntityPersister.java:1617)
    at org.hibernate.persister.entity.BasicEntityPersiste r.dehydrate(BasicEntityPersister.java:1594)
    at org.hibernate.persister.entity.BasicEntityPersiste r.insert(BasicEntityPersister.java:1850)
    ... 11 more

Similar Threads

  1. SQL Insert Help!!!!
    By shaungoater in forum New To Java
    Replies: 1
    Last Post: 06-14-2008, 03:14 AM
  2. Replies: 1
    Last Post: 03-08-2008, 06:41 PM
  3. How do insert a Graphic
    By carl in forum New To Java
    Replies: 1
    Last Post: 08-01-2007, 05:30 AM
  4. how to insert tables into JTextPane
    By osval in forum AWT / Swing
    Replies: 1
    Last Post: 07-29-2007, 09:11 AM
  5. Replies: 2
    Last Post: 06-30-2007, 03:01 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •