java - unable to connect to Mongodb using HibernateOGM -
i want use hibernateogm interact mongodb. have cfg.xml
file this:
<hibernate-configuration> <session-factory> <property name="hibernate.transaction.factory_class">org.transaction.jdbctransactionfactory</property> <property name="hibernate.current_session_context_class">thread</property> <property name="hibernate.ogm.datastore.provider">mongodb</property> <property name="hibernate.ogm.datastore.grid_dialect">org.hibernate.ogm.dialect.mongodbdialect</property> <property name="hibernate.ogm.mongodb.database">rcfdb</property> <property name="hibernate.ogm.mongodb.host">127.0.0.1</property> <property name="hibernate.ogm.mongodb.port">27017</property> <property name="hibernate.connection.provider_class">org.hibernate.connection.c3p0connectionprovider</property> <mapping resource="hibernate-contact.hbm.xml"/> </session-factory> </hibernate-configuration>
i have wrote pojo class, , in main class want populate database in mongodb code, not able job , these line of infos, how can solve that:
session session=null; ogmconfiguration cfgogm=new ogmconfiguration(); sessionfactory sessionfactory= cfgogm.buildsessionfactory(); session=sessionfactory.opensession(); session.begintransaction(); system.out.println("populating database..."); contact cnt=new contact(); cnt.setfirstname("blabla"); cnt.setlastname("blabla"); cnt.setemail("blabla"); session.save(cnt); session.gettransaction().commit(); system.out.println("done... :)");
i have no output code, , no exceptions
info lines:
this structure of project:
you have specified mongodbdialect
in configuration file. on console log, getting noopdialect
on hhh000400
. , in next line, getting connection null
. , last line is, unable create requested service
.
Comments
Post a Comment