On 4 Jan 2014, at 10:24, Martin Braun <martinbraun...@aol.com> wrote:
> Uhm. I totally forgot to add this functionality in my rewrite (I have > rewritten most of the code last weekend) > and I implemented a way to pass parameters into QueryTypes. You can even pass > parameters that are dynamically > determined by stating the property to get its value from. With that you can > easily do RangeQueryTypes. > If you want me to elaborate on that, I can provide you with an example. That would be cool. > In the annotation Version it would look something like this (example from > above): > > @Queries(@Query(must = { > @Must(subQuery = "queryAOrQueryD"), > @Must(subQuery = "queryBOrQueryC"), > @Must(subQuery = "queryE")})) > @SubQueries({ > @SubQuery(id = "queryAOrQueryD", > query = @Query(should = {@Should(subQuery = "queryA"), > @Should(subQuery = "queryD")}) > @SubQuery(id = "queryBOrQueryC", > query = @Query(should = {@Should(subQuery = "queryB"), > @Should(subQuery = "queryC")}) > ... > //define query[A-E] here. > }) I have to say that his boggles my mind. You have to do a lot of mind work and jumping forward and backward to put things together. I guess we can agree that this is not a silver bullet which makes writing queries objectively easier to write. > Maybe it's because I don't like to work with the Junctions and put them > together myself, Well, you still have to put things together, just in annotation in this case. Looping back to Emmanuel’s initial idea, maybe a combination of DSL and parameter holder would be a better way to go. I could imagine that would could drop the various ‘matching’ clauses and instead in the end just pass the parameter bean to createQuery. Basically, instead of: Query query = monthQb .keyword() .fuzzy() .withThreshold( .8f ) .withPrefixLength( 1 ) .onField( "mythology" ) .matching( "calder” ) ... .createQuery(); one would write something like: Query query = monthQb .keyword() .fuzzy() .withThreshold( .8f ) .withPrefixLength( 1 ) .onField( "mythology" ) … .createQuery(paramterWrapper); —Hardy _______________________________________________ hibernate-dev mailing list hibernate-dev@lists.jboss.org https://lists.jboss.org/mailman/listinfo/hibernate-dev