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

  • SEARCH
  • Home
  • 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 3847364
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T16:32:26+00:00 2026-05-19T16:32:26+00:00

I am taking a ‘Keyword’ and table name from user. Now, I want to

  • 0

I am taking a ‘Keyword’ and table name from user.
Now, I want to find all the columns of table whose data type is varchar(String).
Then I will create query which will compare the keyword with those column and matching rows will be returned as result set.

I tried desc table_name query, but it didn’t work.

Can we write describe table query in JPQL?
If not then is there any other way to solve above situation?
Please help and thank you in advance.

  • 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-05-19T16:32:26+00:00Added an answer on May 19, 2026 at 4:32 pm

    No workaround is necessary, because it’s not a drawback of the technology. It is not JPQL that needs to be changed, it’s your choice of technology. In JPQL you cannot even select data from a table. You select from classes, and these can be mapped to multiple tables at once, resulting in SQL joins for simplest queries. Describing such a join would be meaningless. And even if you could describe a table, you do not use names of columns in JPQL, but properties of objects. Describing tables in JPQL makes no sense.

    JPQL is meant for querying objects, not tables. Also, it is meant for static work (where classes are mapped to relations once and for good) and not for dynamic things like mapping tables to objects on-the-fly or live inspection of database (that is what ror’s AR is for). Dynamic discovery of properties is not a part of that.

    Depending on what you really want to achieve (we only know what you are trying to do, that’s different) you have two basic choices:

    • if you are trying to write a piece of software in a dynamic way, so that it adjusts itself to changes in schema – drop JPQL (or any other ORM). Java classes are meant to be static, you can’t really map them to dynamic tables (or grow new attributes). Use rowsets, they work fine and they will let you use SQL;

    • if you are building a clever library that can be shared by many projects and so has to work with many different static mappings, use reflection API to find properties of objects that you query for. Names of columns in the table will not help you anyway, since in JPQL queries you have to use names defined in mappings.

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

Sidebar

Related Questions

After taking all the required privileges from a user I want to display a
Taking a look at my question HERE , I now want to return the
Taking in consideration a table tbl_users , I want to get a list of
When taking data from a HTML form and storing a value in a serialised
Taking this file as an example, I'm trying to read the data in a
Taking out all of the obvious caveats related to benchmarks and benchmark comparison, is
taking value in 1st textbox and want to display it in 2nd.. 1st <input
Taking user input such as tomorrow, in three days, 3 months 30 days, march
Taking beginning Data Structures in C# class, trying to make a searchable arraylist of
Taking into account that some Windows Installer products from independent vendors (for example IstallShield)

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.