Hi, The current implementation of this feature is geared towards high performance, which means trying to avoid serialization (at least for in-memory databases), trying to avoid calling toString, and rather calling the classes compareTo, hashCode, and equals methods.
Regards, Thomas On Sat, Jul 14, 2012 at 1:09 PM, Sergi Vladykin <[email protected]> wrote: > Hi, > > This is known limitation. Currently H2 does not know how to convert string > to your object type other then to parse hexadecimal data. For such a query > you have to use prepared statement and set parameter as .setObject(1, > yourObject, Types.JAVA_OBJECT). yourObject here is not a String but object > of type you stored in database. If you want to find object whos toString() > method returns "SomeText" you can write it as ...where 'SomeText' = > cast(Object as varchar). > Read more at > http://h2database.com/javadoc/org/h2/constant/SysProperties.html#h2.serializeJavaObject > > Sergi > > On Saturday, July 14, 2012 12:22:03 PM UTC+4, Christopher Deckers wrote: >> >> Hi Noel, >> >> > I'd be willing to take the Comparable part of this patch if it included >> > an >> > addition to our unit-test framework. (hint, hint :-) >> >> I was about to set it up to work on it when I saw the following: >> >> "Version 1.3.168 (2012-07-13) >> New system property "h2.serializeJavaObject" (default: true) that >> allows to disable serializing Java objects, so that the objects >> compareTo and toString methods can be used." >> >> So, instead I downloaded the latest, installed it in our system, and >> set the property: System.setProperty("h2.serializeJavaObject", >> "false"); >> >> Then I tried something like: >> SELECT * FROM Data WHERE Object = 'SomeText' >> >> and got the error: >> Hexadecimal string contains non-hex character: "SomeText"; SQL >> statement: SELECT * FROM Data WHERE Object = 'SomeText' [90004-168] >> >> Have I done something wrong or is there something I am missing? >> >> Cheers, >> -Christopher > > -- > You received this message because you are subscribed to the Google Groups > "H2 Database" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/h2-database/-/O8dKpofboP4J. > > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/h2-database?hl=en. -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/h2-database?hl=en.
