• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Bear Bibeault
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh

How to write a HQL in intellij in java based hibernate configuration ?

 
Ranch Hand
Posts: 50
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In my spring mvc project I have configure hibernate using annotation based.


Now when I am trying to write HQL intellij can not find the entity class. It says : "can not resolve symbol 'User'". I have googled it, and I found that hibernate.cfg.xml file should be mapped by the intellij.

Now the problem is I don't have this hibernate config file. I have configure hibernate using java based.

So the question is , How to write a HQL in intellij in java based hibernate configuration ?

Thank you
 
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you show/share your query? Because that error is (normally) shown when you use a class using its simple name without an import statement. But if you are writing a HQL query, the query itself is a String. So that would be weird to get such an error on a String.
 
Muztaba Hasanat
Ranch Hand
Posts: 50
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Roel De Nijs wrote:Can you show/share your query?


This is basic delete query.



In this name variable can not resolve.
 
Roel De Nijs
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Muztaba Hasanat wrote:In this name variable can not resolve.


I assume that's an error you get when trying to run your application, not when writing the code.

And what about using this query
 
Muztaba Hasanat
Ranch Hand
Posts: 50
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Roel De Nijs wrote:

Muztaba Hasanat wrote:In this name variable can not resolve.


I assume that's an error you get when trying to run your application, not when writing the code.

And what about using this query


Nope. I am getting this error when I am writing code. It is saying

Here is my screen shot :

 
Roel De Nijs
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are correct! (I am a very recent IntelliJ user with only 2 months experience, so I didn't know that )

It seems you can use Annotation Config when you are using the Spring Facet, but this option is not available if you configure the Hibernate and JPA Facet. I have no idea how to solve it. Maybe contact IntelliJ IDEA support and submit a request?

PS. I have added this topic to the IDEs forum as well. Maybe someone knows how it can be solved.
 
Muztaba Hasanat
Ranch Hand
Posts: 50
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Roel De Nijs wrote:You are correct! (I am a very recent IntelliJ user with only 2 months experience, so I didn't know that )

It seems you can use Annotation Config when you are using the Spring Facet, but this option is not available if you configure the Hibernate and JPA Facet. I have no idea how to solve it. Maybe contact IntelliJ IDEA support and submit a request?

PS. I have added this topic to the IDEs forum as well. Maybe someone knows how it can be solved.


thank you.

could you give me your intellij forum post link ? Therefore I can also keep track the update.
 
Roel De Nijs
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Muztaba Hasanat wrote:could you give me your intellij forum post link ? Therefore I can also keep track the update.


I suggested you should submit a request, so I didn't submit one myself
 
Muztaba Hasanat
Ranch Hand
Posts: 50
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Roel De Nijs wrote:

Muztaba Hasanat wrote:could you give me your intellij forum post link ? Therefore I can also keep track the update.


I suggested you should submit a request, so I didn't submit one myself

ok
 
Muztaba Hasanat
Ranch Hand
Posts: 50
1
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Muztaba Hasanat wrote:

Roel De Nijs wrote:

Muztaba Hasanat wrote:could you give me your intellij forum post link ? Therefore I can also keep track the update.


I suggested you should submit a request, so I didn't submit one myself

ok


It works. I have posted in reddit. They said it is only IDE that gives this error.

Here is my reddit post link.
https://www.reddit.com/r/javahelp/comments/48lphm/how_to_write_a_hql_in_intellij_in_java_based/
 
Roel De Nijs
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Muztaba Hasanat wrote:It works. I have posted in reddit. They said it is only IDE that gives this error.


Awesome! Have a cow for coming back and sharing the solution.
 
Muztaba Hasanat
Ranch Hand
Posts: 50
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Roel De Nijs wrote:

Muztaba Hasanat wrote:It works. I have posted in reddit. They said it is only IDE that gives this error.


Awesome! Have a cow for coming back and sharing the solution.


Thanks
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic