Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] QueryByExample and inherited class properties..

I have a class A that inherits from B .B has a property called "BName"
.I am trying to use the QueryByExample on A's instance and i set the
name to be "BNameValue". When i use the ReadAllQuery in the following
way

          ReadAllQuery query = (exp == null ? new
ReadAllQuery(qbe.getClass()) : new ReadAllQuery(qbe.getClass(), exp))
;
            QueryByExamplePolicy qbePolicy = new QueryByExamplePolicy() ;

            qbePolicy.addSpecialOperation(String.class, "likeIgnoreCase");
            query.setExampleObject(qbe) ;
            query.setQueryByExamplePolicy(qbePolicy) ;
            query.setShouldFilterDuplicates(true) ;
             query.getResult()

I was expecting that it would query on B's name but the SQL i am
seeing doesn't have any of the base class properties in it.. it just
does all of A's properties but doesn't use any of B's property . Is
there some thing different i should do to get the SQL to generate with
B's name.


@Entity
public class B
{
@Column(name="BName", nullable=true, length=80)

private String BName;

}

@Entity
@DiscriminatorValue("K")
public class A extends B
{
   id
}


my query is A a = new A();
a.setBName("BName");

my SQL query is "SELECT ID,DITYPE FROM A WHERE (DITYPE = ?)
	bind => ["DITypeValue"]

and its not including BName in its query.

Why is eclipselink automatically not using any of the base class
properties when generating the SQL?

Cheers
Vaidya


Back to the top