Questions tagged [query-by-example]

97 questions
2
votes
1 answer

Hibernate Example Criteria query: filtering by child properties

I have done my fair amount of research and finally decided to ask this. I have two classes like this: Employee -emp_id -name -dep_id Department -dep_id -name I'm using this code to query by example: List find = null; Example example =…
er_tomas
  • 59
  • 8
2
votes
0 answers

How to mock ExampleMatchers by Example in java Using Mockito

Here is the example data: public List findByExample(Test bean) { ExampleMatcher matcher = DefaultExampleMatcher.exampleMatcher(); Example exampleQuery = Example.of(bean, matcher); return…
user12639212
2
votes
1 answer

Query By example and boolean field

In class Users, I have a field id, firstname, lastname, username, password, enabled. Enabled field is boolean When i use do this query by example with spring Users users = new Users(); users.setId(12); Example example =…
robert trudel
  • 5,283
  • 17
  • 72
  • 124
2
votes
1 answer

JPA QBE with @JoinTable

I am using the recently released QBE functionality through spring-data-jpa. Everything seems to work just fine, with the one exception being that fields annotated as @JoinTable do not seem to work. I've tried simple primitives on the entity, as…
Troy Doty
  • 23
  • 4
2
votes
1 answer

how to search an Id using hibernate query by example?

hi i have the following class public class Label { private Long TableId; private Long Id; private String LabelName; //getters and setters for corresponding fields } i was supposed to search on multiple fields dynamically i…
user31481
  • 71
  • 1
  • 7
2
votes
3 answers

Hibernate org.hibernate.criterion.Example.create OR clause

I'm using org.hibernate.criterion.Example.create to create my query from my Entity object. Everything is fine, but using this method the SQL is only created with AND clause between the restrictions. Is it possible to use…
Sergio Santiago
  • 1,316
  • 1
  • 11
  • 19
1
vote
2 answers

Is it possible to search for a Guid in a "Query By Example"?

I need to find whether a computer with a given Guid exists inside a given OU. To do this, I'd prefer to write a Query By Example that searches for a computer matching a Guid. For example: PrincipalContext context = new…
Eric
  • 5,842
  • 7
  • 42
  • 71
1
vote
1 answer

Hibernate: Query By Example involving one-to-many relationship

I've recently started playing with the query by example component of the Criteria API and have run into a strange issue - an org.hibernate.QueryException is thrown when trying to perform a search. My scenarios is as follows: I have a class A, which…
filip-fku
  • 3,265
  • 1
  • 21
  • 19
1
vote
1 answer

Mixing Likes and Equals with NHibernate Query-By-Example?

I have a rather large SOA solution and a newly added service queries approx 9.8 million records using NHibernate's Query By Example. Thus far the performance has been terrible, and a profile on the database shows the query as: exec sp_executesql…
bryan
  • 1,031
  • 2
  • 17
  • 36
1
vote
1 answer

Spring boot query by example with nested object

I have 2 entities: field and crop. Field looks like this: public class Field { private Integer id; private String name; @ManyToOne @JoinColumn(name = "crop") private Crop crop; } public class Crop { private Integer id; private String…
hido
  • 63
  • 8
1
vote
0 answers

Spring Data JPA Query using on @ManyToOne object

Assume we have Student and College class Student { private Long id; //... @ManyToOne() @JoinColumn(name = "college_id") private College college; } public class College { private Long id; //... @OneToMany(mappedBy…
1
vote
0 answers

hibernate Query By Example disapperar in v 6.0.0

I used in the past hibernate QBE as : Session session = (Session) em.unwrap(Session.class); Example example = Example.create(entityFrom) This code is compiled normaly until Hibernate core version 5.6
KronosOne
  • 67
  • 2
  • 8
1
vote
1 answer

How can I reference dynamic keys on an object in jq?

I'm trying to define some custom filter functions and one thing I need to be able to do is pass a list of strings to a filter and get the corresponding values of the input object. For example: jq -n '{name: "Chris", age: 25, city: "Chicago"} |…
Christopher Shroba
  • 7,006
  • 8
  • 40
  • 68
1
vote
1 answer

Intercept repository method calls in Spring Data, refining the query on the fly

Say I've got a few interfaces extending CRUDRepositor. There are methods in there like findByField. Some of these methods should only return entities that belong to a group of entities to which the user has access (the group is a column in the…
1
vote
1 answer

Spring data mongoDB : Find all by child object id with Example Executor and Pageable

I am facing issue in querying repository with find all by child object ID, Example and Pageable. StudentController.java @RestController @RequestMapping("/students") public class StudentController { @Autowired private StudentService…