[hibernate-dev] Is there any official Hibernate framework in C++ ?

f s seiya.kawashima at gmail.com
Mon Dec 19 08:55:14 EST 2011


Hi,

I would like to use Hibernate in C++. However, it seems to me that there
are no official Hibernate or wrapper frameworks for the purpose.
Do you think that it would be workable as production ready software if
Hibernate is used through JNI from C++ ?
Or is there any official plan to port Hibernate to C++ ?

I've recently added a project called
CppHibernate<https://github.com/seiyak/CppHibernate>at github to use
Hibernate in C++ through JNI which looks like below.

CppHibernateJVMConfiguration
configuration("/root/classpath/your/hibernate.cfg.xml/lives");
URLClassLoader loader =
URLClassLoader(configuration.getJNIEnv(),"/path/to/hibernate/jar/files");
CppHibernateObjectHelper helper =
CppHibernateObjectHelper(configuration.getJNIEnv(),&loader);
CppHibernate hibernate = CppHibernate(&configuration,&loader);

CppHibernateSession *session =
hibernate.getSessionFactory()->getCurrentSession();
CppHibernateTransaction *transaction = session->beginTransaction();

//// do some work. Here saves an object.
CppHibernateJObject *obj1 =
helper.createJObjectWith("org.hibernateDomain.Event");
CppHibernateJStringObject *obj1Str =
helper.createJStringObjectWith("title1");
obj1->setVal("title",obj1Str);
session->saveObj(obj1);
delete obj1;
delete obj1Str;

transaction->commit();
delete transaction;
delete session;

If this question has already been asked or is irrelevant to this mailing
list, please discard the question.
Thank you
Seiya



More information about the hibernate-dev mailing list