> I think there is justification for addition abstraction on POJO.
>
> like
>
> @Entity
> class Cat {
> String name;
> public static class ZpCat extedns ZpBase {
> public Property name = createProperty(Cat.class, "name");
> public static final ZpCat ZP = new ZpCat(Cat.class);
> }
>
> }
>
> from(ZpCat.ZP).where(ZpCat.ZP.name.between("A", "B"));
>
> So Cat is Pojo for model business which hold and operate on data and
> ZpCat is for queries for Cat.
>
> What are you thinking? ;>
That's what we are doing. The domain model for the queries can be
easily auto-generated via APT.
Also using a prefix like Zp* is not necessary, you could use a
different package.
Here is an example from our test suite :
public static final class Department extends
Path.Entity<com.mysema.query.grammar.hql.HqlDomain.Department>{
public final Path.String name = _string("name");
public final Path.Comparable<java.lang.Integer> id =
_comparable("id",java.lang.Integer.class);
public final
Path.EntityList<com.mysema.query.grammar.hql.HqlDomain.Employee>
employees =
_entitylist("employees",com.mysema.query.grammar.hql.HqlDomain.Employee.class);
public Employee employees(int index) {
return new Employee(forListAccess(employees,index));
}
public Employee employees(Expr<Integer> index) {
return new Employee(forListAccess(employees,index));
}
public Company company;
public Company _company() {
if (company == null) company = new
Company(forProperty(this,"company"));
return company;
}
public Department(java.lang.String path) {
super(com.mysema.query.grammar.hql.HqlDomain.Department.class, path);
_company();
}
public Department(PathMetadata<?> metadata) {
super(com.mysema.query.grammar.hql.HqlDomain.Department.class,
metadata);
}
}