Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate query

 
saurav sarkar
Ranch Hand
Posts: 180
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All i was using Hibernate tutorial to learn Hibernate.

I had created the database table mentioned as 'Book' in the microsoft access.

For that i am getting this error.I found this error comes when the MS Access does not support datatypes as of mentioned in the SQL query.
I am not sure what datatype to mention the O-R mapping file as i am xtremely new to Hibernate

[code]

org.hibernate.exception.GenericJDBCException: could not insert: [roseindia.tutorial.hibernate.Book]
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.entity.BasicEntityPersister.insert(BasicEntityPersister.java:1839)
at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:2171)
at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:46)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:239)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:223)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:136)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:274)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:669)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:293)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:86)
at roseindia.tutorial.hibernate.IdIncrementExample.main(IdIncrementExample.java:33)
Caused by: java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver]Optional feature not implemented
at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6958)
at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7115)
at sun.jdbc.odbc.JdbcOdbc.SQLBindInParameterBigint(JdbcOdbc.java:1225)
at sun.jdbc.odbc.JdbcOdbcPreparedStatement.setLong(JdbcOdbcPreparedStatement.java:592)
at org.hibernate.type.LongType.set(LongType.java:40)
at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:62)
at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:44)
at org.hibernate.persister.entity.BasicEntityPersister.dehydrate(BasicEntityPersister.java:1603)
at org.hibernate.persister.entity.BasicEntityPersister.dehydrate(BasicEntityPersister.java:1569)
at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:1820)
... 11 more

[code]

Please help me to resolve this problem.

Thanks in advance,
Saurav
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34672
367
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We have a separate forum for ORMs like Hibernate. I'll move this there for you where people will know more about Hibernate.
 
saurav sarkar
Ranch Hand
Posts: 180
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hibernate experts please help me.......i am desperate to learn
Hibernate...........Cheers
 
Arun Kumarr
Ranch Hand
Posts: 661
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Get us more details of your error. Post the hibernate.cfg file and tell us how do you get to the MS-Access datasource. Try using direct jdbc access drivers than a jdbc-odbc bridge. See if you have bound your DSN correctly.
[ July 30, 2007: Message edited by: Arun Kumarr ]
 
saurav sarkar
Ranch Hand
Posts: 180
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks Arun for the reply.

My Hibernate cfg file



I am configuring the connection through the ODBC administrator of Windows.

PLease help
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Caused by: java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver]Optional feature not implemented


Microsoft Access driver might not have implemented this feature. Why not use some other database instead of MS Access? You could use MySQL which is a free.
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Looking at the hibernate config that you posted, it appears that you are using MySQL dialect with your MS Access Database driver:

<property name="dialect">org.hibernate.dialect.MySQLDialect</property>


Better use MySQL database (and its corresponding driver) with this dialect
 
Arun Kumarr
Ranch Hand
Posts: 661
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Did you try using direct jdbc driver? If not try getting one here.

I saw the example. They have specifically mentioned to create the table in MySQL. Why are you using MS-Access?

Check what you have mentioned in the mapping file and in the Class. Do you have "Long" in the POJO and "long" in the mapping file?
 
saurav sarkar
Ranch Hand
Posts: 180
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Jaikiran and Arun for your replies.
Problem i can download anything in my desktop.
Thata why i am going with Access.
I think the dialect property needs to be changed
as i am using MS Access.But i have not
found any dialect specific for MS Accesss in the
Hibernate Reference manual
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic