1

我在我的项目中使用休眠框架,我选择使用注释方法。我也在使用 H2 嵌入式数据库“文件模式”。在我的编辑器和可分发的 jar 文件中,每件事都可以正常工作。我选择 jasper 报告来创建报告,但是在 JRSudio 中设置休眠数据源时遇到了问题。

请注意,我已经在 J​​RStudio 中设置了类文件夹的类路径。

在此处输入图像描述

她是这个问题的堆栈跟踪。

net.sf.jasperreports.engine.JRException: java.lang.reflect.InvocationTargetException
    at net.sf.jasperreports.data.hibernate.HibernateDataAdapterService.contributeParameters(HibernateDataAdapterService.java:129)
    at net.sf.jasperreports.data.AbstractDataAdapterService.test(AbstractDataAdapterService.java:105)
    at com.jaspersoft.studio.data.wizard.AbstractDataAdapterWizard$3.runOperations(AbstractDataAdapterWizard.java:162)
    at com.jaspersoft.studio.utils.jobs.CheckedRunnableWithProgress$1.run(CheckedRunnableWithProgress.java:59)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at net.sf.jasperreports.data.hibernate.HibernateDataAdapterService.contributeParameters(HibernateDataAdapterService.java:102)
    ... 4 more
Caused by: org.hibernate.MappingException: Could not determine type for: javafx.beans.property.ObjectProperty, at table: TTransaction, for columns: [org.hibernate.mapping.Column(amount)]
    at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:292)
    at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:276)
    at org.hibernate.mapping.Property.isValid(Property.java:207)
    at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:458)
    at org.hibernate.mapping.RootClass.validate(RootClass.java:215)
    at org.hibernate.cfg.Configuration.validate(Configuration.java:1149)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1334)
    at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:859)
    ... 9 more

休眠配置文件:

<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
        "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
        "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">

<hibernate-configuration>

    <session-factory>

        <!-- Database connection settings -->
        <property name="connection.driver_class">org.h2.Driver</property>
        <property name="connection.url">jdbc:h2:file:./db/entrepriseLimited;IFEXISTS=TRUE</property>

        <property name="connection.username">myUserName</property>
        <property name="connection.password">myPass</property>


        <!-- SQL dialect -->
        <property name="dialect">org.hibernate.dialect.H2Dialect</property>

        <!-- Echo all executed SQL to stdout -->
        <property name="show_sql">true</property>

        <mapping class="bean.Entreprise"/>
        <mapping class="bean.Account"/>
        <mapping class="bean.typeOfTransaction.TypeOfTransaction"/>
        <mapping class="bean.typeOfTransaction.CreditTypeOfTransaction"/>
        <mapping class="bean.typeOfTransaction.DebitTypeOfTransaction"/>
        <mapping class="bean.DebitTaxe"/>
        <mapping class="bean.transaction.Transaction"/>
        <mapping class="bean.transaction.Debit"/>
        <mapping class="bean.transaction.Credit"/>
        <mapping class="bean.person.User"/>
        <mapping class="bean.person.Customer"/>
        <mapping class="bean.person.PhysicPerson"/>

    </session-factory>

</hibernate-configuration>

那么什么会导致这个问题呢?

4

0 回答 0