简体   繁体   English

如何使用Google GenericDAO中的Seach和Filter类来查找未映射的类对象?

[英]How can I use Seach and Filter classes from Google GenericDAO for seaching not mapped class objects?

I have Bridge class: 我有桥课:

public class Bridge extends Attribute{
    String name;
    //getters and setters
}

this class used for mapping. 此类用于映射。 Bridge.hbm.xml: Bridge.hbm.xml:

<?xml version="1.0" ?>
<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping>
    <class name="pack.persistent.Bridge" table="bridge">
        <property name="name"/>
    </class>
</hibernate-mapping>

Attribute class also: 属性类还包括:

public class Attribute{
    String description;
    //gettors, setters & something else
}

When I use Google GenericDAO framework for searching some entity using filter I can search only by name field, but not by description . 当我使用Google GenericDAO框架通过过滤器搜索某些实体时,我只能按name字段进行搜索,而不能按description

How can I use Search and Filter classes from Google GenericDAO framework for seaching not mapped class objects? 如何使用Google GenericDAO框架中的SearchFilter类来Search未映射的类对象?

you need to add the field description in Bridge.hbm.xml 您需要在Bridge.hbm.xml中添加字段描述

<hibernate-mapping>
    <class name="pack.persistent.Bridge" table="bridge">
        <property name="name"/>
        <property name="description"/>
    </class>
</hibernate-mapping>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM