Hi,
i'm a bit stuck and i searched a while now, not finding an answer.
I' tring to find something like this:
lets say we have products and manufactures.
My Product class has got a property Manufacturer:
Code:
@Entity
@Audited
@Table
public class Product {
private int id;
private String name;
private Manufacturer manufacturer;
@Id
public int getId() { return this.id; }
@ManyToOne
@JoinColumn(name = "MANUFACTOR_ID")
public Manufacturer getManufacturer() { return this.manufacturer; }
@Column
getName()...
}
@Entity
@Audited
@Table
public class Manufacturer {
private int id;
private String name;
private Set<Product> products = new HashSet<>(0);
@Id
public int getId() { return this.id; }
@OneToMany(mappedBy = "manufacturer")
public getProducts() { return this.products; }
@Column
getName()...
}
i want to get all products where manufacurer name like "acme"
I've tried this but it didn't work:
AuditReader ar = AuditReaderFactory.get(session);
AuditQuery query = ar.createQuery().forEntitiesAtRevision(Product.class, 5L);
query.add(AuditEntity.property("manufacturer.name").ilike("acme", MatchMode.ANYWHERE));
Quote:
could not resolve property: manufacturer of: my.path.Product_AUD
Note this is just a sample to understand my problem. I can't provide original classes. If there are typing errors ist because i coded this example in this editor here.
so basicly i want to check a nested property.
Maybe this is not the correct way, so im asking for the correct way to query products where manufacturer name is like "acme"...
Thanks!