You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by endian675 <mi...@griggs.org.uk> on 2015/09/22 10:18:39 UTC
QuerySqlField on a Java.util.map ?
If I have a class declared as follows:
public class Resolve { public Map<IdentifierEnum, String>
identifiers; }
is it possible to add a @QuerySqlField attribute to the identifiers field,
but search within the *contents *of that field via a SQL query?
--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/QuerySqlField-on-a-Java-util-map-tp1458.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.
Re: QuerySqlField on a Java.util.map ?
Posted by Sergi Vladykin <se...@gmail.com>.
Hi,
Yes, you can annotate `identifiers` with @QuerySqlField.
To search within the contents you can use User defined functions (see
https://ignite.apache.org/releases/1.3.0/javadoc/org/apache/ignite/cache/query/annotations/QuerySqlFunction.html
)
For example create function `get` like below and use in query like: SELECT
_VAL FROM Resolve where get(identifiers, ?) = ?
Though you will not be able to use indexes this way.
@QuerySqlFunction
public static String get(Map<IdentifierEnum, String> identifiers,
IdentifierEnum id) {
return identifiers.get(id);
}
Sergi
2015-09-22 11:18 GMT+03:00 endian675 <mi...@griggs.org.uk>:
> If I have a class declared as follows:
>
> public class Resolve
> {
> public Map<IdentifierEnum, String> identifiers;
> }
>
> is it possible to add a @QuerySqlField attribute to the identifiers
> field, but search within the *contents *of that field via a SQL query?
> ------------------------------
> View this message in context: QuerySqlField on a Java.util.map ?
> <http://apache-ignite-users.70518.x6.nabble.com/QuerySqlField-on-a-Java-util-map-tp1458.html>
> Sent from the Apache Ignite Users mailing list archive
> <http://apache-ignite-users.70518.x6.nabble.com/> at Nabble.com.
>