aspose file tools*
The moose likes Object Relational Mapping and the fly likes Hibernate query Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate query" Watch "Hibernate query" New topic
Author

Hibernate query

saurav sarkar
Ranch Hand

Joined: Jan 07, 2007
Posts: 180

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


Be Objectively Oriented.Explore the power of OOPs.
My Blog, Eclipse EMF Query committer.
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30919
    
158

We have a separate forum for ORMs like Hibernate. I'll move this there for you where people will know more about Hibernate.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
saurav sarkar
Ranch Hand

Joined: Jan 07, 2007
Posts: 180

Hibernate experts please help me.......i am desperate to learn
Hibernate...........Cheers
Arun Kumarr
Ranch Hand

Joined: May 16, 2005
Posts: 513

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 ]

If you are not laughing at yourself, then you just didn't get the joke.
saurav sarkar
Ranch Hand

Joined: Jan 07, 2007
Posts: 180

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

Joined: Jul 20, 2005
Posts: 10263
    
168

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.


[My Blog] [JavaRanch Journal]
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10263
    
168

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

Joined: May 16, 2005
Posts: 513

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

Joined: Jan 07, 2007
Posts: 180

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Hibernate query