Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8148155
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T14:35:30+00:00 2026-06-06T14:35:30+00:00

Using java If I store windows paths in a h2 database, and then try

  • 0

Using java If I store windows paths in a h2 database, and then try and retrieve the objects using Hibernate by matching on the filename
i.e

public static List<Object[]> findSongsRecNoAndModifiedDateWithinFolder(Session session, String folder)
    {
        Query q = session.createQuery("select recNo, filename, lastModified from Song t1 where t1.filename like :filename");
        q.setParameter("filename", folder+'%', StandardBasicTypes.STRING);
        List<Object[]> results = (List<Object[]>)q.list();
        return results;
    }

I get no matches.

If I convert all the ‘\’ with ‘/’ when I add to the database and try and retrieve it all works, but this is a bit of a pain I was trying to ignore the differences between UNIX and Windows files paths.

So the problem is something to do with Windows file separator ‘\’ also being Java (and Database) escape character. but what I don’t really understand is the problem with Java, the database or hibernate and if I can work round it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T14:35:31+00:00Added an answer on June 6, 2026 at 2:35 pm

    See http://groups.google.com/group/h2-database/browse_thread/thread/390eed5e21584faa?pli=1 for an answer to your question: \ is the default escape character in H2, and you need to escape it (with another \) if you use it in a like clause.

    Or you can set the default escape character to an empty string to avoid this escaping problem. See http://www.h2database.com/javadoc/org/h2/constant/DbSettings.html and search for “defaultEscape”.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am collecting data and store this data in a MySQL database using Java.
I have a C program that stores some object in java store using JNI.
Using Java IO streams, it is quite often we use objects solely as constructors
I'm porting a Windows app written in C# to Mac OS using Java and
I have a java swing database application which needs to be run on Windows
We're using Spring/Hibernate on a Websphere Application Server for AIX. On my Windows machine,
I'm trying to store MediumBlob data in MySQL using java. But I have no
How do i create a form in google app engine using java and store
I'm reviewing my code My Java application runs on Windows and Unix using Java
Using java I am trying to develop a method using recursion to analyze a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.