0

I am getting an exception while using @Column annotation in hibernate.

Below is the exception:

   SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Hibernate: insert into USER_DETAILS (Permanent Address, description, Joined Date, Name, ID) values (?, ?, ?, ?, ?)
Exception in thread "main" org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update
    at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:92)
    at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
    at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:275)
    at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:268)
    at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:184)
    at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
    at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:51)
    at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1216)
    at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:383)
    at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:133)
    at org.hibernate.tutorial.manjosh.HibernateTest.main(HibernateTest.java:27)
Caused by: java.sql.BatchUpdateException: ORA-00917: missing comma

    at oracle.jdbc.driver.DatabaseError.throwBatchUpdateException(DatabaseError.java:343)
    at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:10720)
    at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:70)
    at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:268)
    ... 8 more
`
Apostolos
  • 10,033
  • 5
  • 24
  • 39
manjosh
  • 438
  • 6
  • 28

2 Answers2

0

please change your insert to

insert into USER_DETAILS ('Permanent Address', 'description', 'Joined Date', 'Name', 'ID') values (?, ?, ?, ?, ?)
Apostolos
  • 10,033
  • 5
  • 24
  • 39
0

Please refer to this post.

You essentially need to escape your column names; however, I'd recommend avoiding these types of uses so that you don't need to use this strategy.

Community
  • 1
  • 1
Naros
  • 19,928
  • 3
  • 41
  • 71