c++:cppHibernate问题
在java里。我生成映射文件、普通的java类,通过hql可以查出数据。我把映射文件和java类给c++程序,通过cppHibernate调用,报找不到字段错误。
请看映射文件
<hibernate-mapping>
<class name="com.atman.hci.domain.HciStandardStatements" table="HCI_standard_statements">
<id name="stdStatementId" type="java.lang.Long">
<column name="std_statement_id" />
<generator class="native" />
</id>
<property name="ioFormatId" type="java.lang.Long">
<column name="io_format_id" not-null="true" />
</property>
<property name="stdStatement" column="std_statement" type="string" not-null="true"/>
<property name="createTime" type="java.sql.Timestamp">
<column name="create_time" length="19" not-null="true" />
</property>
<property name="updateTime" type="java.sql.Timestamp">
<column name="update_time" length="19" not-null="true" />
</property>
<property name="available" type="java.lang.Short">
<column name="available" not-null="true" />
</property>
</class>
</hibernate-mapping>
c++通过cppHibernate访问数据库代码
CppHibernateQuery query = session->createQuery("from HciStandardStatements hc where hc.stdStatementId = 1");
CppHibernateJCollectionObject *wh = query.list();
CppHibernateJObject *el2 = wh->get(0);
CppHibernateJStringObject *res2Str = dynamic_cast<CppHibernateJStringObject *>(el2->getVal("stdStatement"));
printf("%s\n", res2Str->getVal());
报错:
Exception in thread "main" java.lang.NoSuchFieldError: stdStatement
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x000000000040f4ff, pid=10083, tid=139953762797344
#
# JRE version: 7.0_21-b11
# Java VM: Java HotSpot(TM) 64-Bit Server VM (23.21-b01 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# C [a.out+0xf4ff] _ZNSs6appendEPKcm@@GLIBCXX_3.4+0xf4ff
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /home/whh/database/cpphibernate/hs_err_pid10083.log
#
# If you would like to submit a bug report, please visit:
# http://bugreport.
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.