Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Muztaba Hasanat
Ranch Hand
Posts: 48
1
  • Mark post as helpful
  • send pies
  • 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
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • 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: 48
1
  • Mark post as helpful
  • send pies
  • 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: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • 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: 48
1
  • Mark post as helpful
  • send pies
  • 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: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • 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: 48
1
  • Mark post as helpful
  • send pies
  • 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: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • 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: 48
1
  • Mark post as helpful
  • send pies
  • 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: 48
1
  • Likes 1
  • Mark post as helpful
  • send pies
  • 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: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Likes 1
  • Mark post as helpful
  • send pies
  • 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: 48
1
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic