• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Hibernate and MS Access?

 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'am developing an application with hibernate . And i have ms access db in hand . Is it possible to connect. How can i connect hibernate to ms access DB. Kindly help me please........
Thanking you in advance...........
 
Bartender
Posts: 4116
72
Mac TypeScript Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You should have the proper driver and the appropriate Hibernate dialect defined. See this for more information about the support for various vendors.
 
Thameem Aliyar
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your reply. I used the same dialect. But I got some errors.

Here's my hibernate.cfg.xml................

And here's the error.......


Failed to create sessionFactory object.org.hibernate.HibernateException: Dialect class not found: com.hxtt.support.hibernate.HxttAccessDialect
Exception in thread "main" java.lang.ExceptionInInitializerError
at com.actions.MsAccessMain.main(MsAccessMain.java:20)
Caused by: org.hibernate.HibernateException: Dialect class not found: com.hxtt.support.hibernate.HxttAccessDialect
at org.hibernate.dialect.resolver.DialectFactory.constructDialect(DialectFactory.java:159)
at org.hibernate.dialect.resolver.DialectFactory.buildDialect(DialectFactory.java:99)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:117)
at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2863)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2859)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1870)
at com.actions.MsAccessMain.main(MsAccessMain.java:17)
Caused by: java.lang.ClassNotFoundException: com.hxtt.support.hibernate.HxttAccessDialect
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:192)
at org.hibernate.dialect.resolver.DialectFactory.constructDialect(DialectFactory.java:156)
... 6 more


Kindly tell me a solution required.

Thanking you in advance................
 
Thameem Aliyar
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I resolved the above error by including hibernate35.jar..
Now i'am getting the following error.......


Failed to create sessionFactory object.java.lang.NoSuchFieldError: INTEGER
Exception in thread "main" java.lang.ExceptionInInitializerError
at com.actions.MsAccessMain.main(MsAccessMain.java:25)
Caused by: java.lang.NoSuchFieldError: INTEGER
at com.hxtt.support.hibernate.HxttDialect.<init>(HxttDialect.java:27)
at com.hxtt.support.hibernate.HxttAccessDialect.<init>(HxttAccessDialect.java:12)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at org.hibernate.dialect.resolver.DialectFactory.constructDialect(DialectFactory.java:156)
at org.hibernate.dialect.resolver.DialectFactory.buildDialect(DialectFactory.java:99)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:117)
at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2863)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2859)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1870)
at com.actions.MsAccessMain.main(MsAccessMain.java:22)


Here's my main method.....



Kindly tell me the solution required.

Thanking you in advance................
 
Vijitha Kumara
Bartender
Posts: 4116
72
Mac TypeScript Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Looks like you have used incompatible types here. Can you show your mapping file and the POJO itself?
 
Thameem Aliyar
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your reply.......... Sorry for the late reply........ its beacause the net was down................

Here's my POJO.........

And here's my mapping xml...

Kindly reply me solution....
Thanking you in advance..............
 
Vijitha Kumara
Bartender
Posts: 4116
72
Mac TypeScript Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is the line corresponding to the line #25 in your MsAccessMain original class (including package, imports etc..)?

And I suggest you first try to get the initialization work properly. Remove other code from the main class and try.
 
Look! I laid an egg! Why does it smell like that? Tiny ad, does this smell weird to you?
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic