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

284 Views Asked by At

I have Bridge class:

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

this class used for mapping. 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.

How can I use Search and Filter classes from Google GenericDAO framework for seaching not mapped class objects?

1

There are 1 best solutions below

4
Mudassar On

you need to add the field description in Bridge.hbm.xml

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