Hi,I would like to serialize QueryDSL Expressions into a human readable (refactorable) String including all parameters and store it in a DB in order to execute the query "later". Calling toString() on a BooleanExpression for instance seems to be a perfect match. However, I do not find a way to create a BooleanExpression from that String meaning I am not able to deserialize the QueryDSL Expression. Has someone tried something similar already?Regards,René
Hi.
Which Querydsl module are you mainly using? If you are using JPA and don't aim for a general approach I'd just serialize the Querydsl queries to JPQL and store the serialized queries and the parameter bindings.
Querydsl queries can also be serialized into binary form.
Br,
Timo
Hi Rene.
There is not yet a parser for Querydsl expressions, but I could provide some guidance, if you are interested in contributing one.
You can either emulate SQL/JPQL in the serialization, or just dump the AST into XML, JSON or some custom tree format, which is much easier. Supporting operations, paths and constants should be enough for quite a while.
Br,
Timo
@Test
public void should_construct_dynamic_path() {
PathBuilder path = new PathBuilder<Content>(Content.class, QContent.content.getMetadata());
String str = "product.price";
for (String element : str.split("\\.")) {
path = path.get(element);
}
assertThat(path).isEqualTo(QContent.content.product.price); // OK
assertThat(path.getType()).isEqualTo(Integer.class); // NOK
}
--
You received this message because you are subscribed to the Google Groups "Querydsl" group.
To unsubscribe from this group and stop receiving emails from it, send an email to querydsl+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Hello,What you can do if you must match the property types, is pass the specific PathBuilderValidator parameter.By default we do not validate the property and it's type, but you can specify PathBuilderValidator.FIELDS to validate the raw field type and PathBuilderValidator.PROPERTIES to validate using the getter.I hope this helps.Br,Ruben
Or maybe it is just possible to make the interface "com.mysema.query.types.path.PathBuilderValidator" to extends "Serializable" please ?
Here is a solution that translates a RSQL string into a QueryDSL predicate. RSQL-QueryDSL
Hi,
Any one done serialiser / deserializer for predicate containing complex objects?
--
You received this message because you are subscribed to a topic in the Google Groups "Querydsl" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/querydsl/p3MFCF1EpjM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to querydsl+unsubscribe@googlegroups.com.
Hi,
Any one done serialiser / deserializer for predicate containing complex objects?
On 27-Nov-2017 6:19 PM, "Ahul via Querydsl" <querydsl+APn2wQcdecyKpvGZhZetsMYW9LuyN9NVLFbo_MTudlH4as9ggW6xg5E@googlegroups.com> wrote:
Hi Scot,--I used this code sample , but getting problems on root class containg complex objects.
On Friday, May 6, 2016 at 6:15:44 PM UTC+5:30, Alex Escot wrote:If it could help you, I send you a gist of my JSON serializer / deserializer with associated unit tests.But it only serialize deserialize Predicate and OrderSpecifier, i don't need more...It has been developped according Timo advices : using Visitor for serialization and PathBuilder for deserialization,Maybe, it could help the community.My syntax is pretty the same as MongoDB.
Le mercredi 4 mai 2016 17:42:16 UTC+2, Sebastian Świerczyna a écrit :Hello,
I'am also interested how to send query over http using JSON.
Anyone ?
W dniu środa, 20 maja 2015 12:02:53 UTC+2 użytkownik Romuald MAIRE napisał:If someone already did that, is it possible to have the serializer/deserializer using JSON please ? ^^
You received this message because you are subscribed to a topic in the Google Groups "Querydsl" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/querydsl/p3MFCF1EpjM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to querydsl+u...@googlegroups.com.
Hi,
I have attached root class and generated Q class, I'm getting problem on Set type in root class, also tried it with List as well.
Thanks
To unsubscribe from this group and all its topics, send an email to querydsl+unsubscribe@googlegroups.com.
Hi,
Please see the root class and Q class
Hi,
I have attached root class and generated Q class, I'm getting problem on Set type in root class, also tried it with List as well.
Thanks
On 30-Nov-2017 12:59 PM, "Alex Escot via Querydsl" <querydsl+APn2wQdol38tEJKmOwcoWZlyKa7dvpeqm6ttFzD14gY2INZGV20YdJc@googlegroups.com> wrote:
Hi,Could you please give us more information about your issue, do you have an example ?Because we are using this serializer/deserialier in our project for more than two years without any issue (As you could see in unit tests, it permits to navigate behind complex complex object).
Le jeudi 30 novembre 2017 07:42:35 UTC+1, Ahul a écrit :
Hi,
Any one done serialiser / deserializer for predicate containing complex objects?