• 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:
  • Devaka Cooray
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
Bartenders:

@Entity Annotations not showing up

 
Ranch Hand
Posts: 218
1
VSCode Eclipse IDE Spring C++ Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Whenever I am trying to get suggestions of @Entity annotation in Spring Tool Suit, I am just not finding it , be it suggestion from javax.persistence, or from org.hibernate.annotations,  

I even have Hibernate dependency in my pom.xml
image_2024-05-04_231037154.png
What I was expecting
What I was expecting
image_2024-05-04_231100289.png
What I am getting instead
What I am getting instead
 
Bartender
Posts: 15743
368
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
javax.persistence has been superseded by jakarta.persistence, and org.hibernate.annotations.Entity has been deprecated in favor of jakarta.persistence.Entity.

In short, what you were expecting is outdated. Use the annotation that your IDE suggests.
 
Swapnil Mishra
Ranch Hand
Posts: 218
1
VSCode Eclipse IDE Spring C++ Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
please tell me how do I add hibernate dependency? in POM.xml file
 
Stephan van Hulst
Bartender
Posts: 15743
368
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You told us you already have a Hibernate dependency in your POM. What makes you think it didn't work?

Please also show us your POM.
 
Swapnil Mishra
Ranch Hand
Posts: 218
1
VSCode Eclipse IDE Spring C++ Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I mean yea, I know how to do it, Just want to know if I am doing it right or not?
 
Swapnil Mishra
Ranch Hand
Posts: 218
1
VSCode Eclipse IDE Spring C++ Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is my xml file :



I have added dependencies of H2 database and Hibernate in my file

to add Hibernate dependency I went to hibernate's homepage hibernate.org and from there followed this getting started guide
of how to Obtain Hibernate using Maven Dependency which showed me the code snippet, I added this snippet inside my dependency tag in my xml file

And to add H2 database dependency I took help of mvnrepository.com

Did I do it right ??
 
Stephan van Hulst
Bartender
Posts: 15743
368
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If your goal is to use only JPA features in your application, then it's better to add a compile-time dependency on Jakarta JPA, and a runtime dependency on Hibernate:
 
Swapnil Mishra
Ranch Hand
Posts: 218
1
VSCode Eclipse IDE Spring C++ Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ok, Thank you
 
Swapnil Mishra
Ranch Hand
Posts: 218
1
VSCode Eclipse IDE Spring C++ Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also, I don't see this @Entity annotation from org.hibernate.annotations, does that mean I have not included hibernate dependency in my xml file??, despite adding this code snippet :

 
Stephan van Hulst
Bartender
Posts: 15743
368
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Stephan van Hulst wrote:org.hibernate.annotations.Entity has been deprecated in favor of jakarta.persistence.Entity.

In short, what you were expecting is outdated.

 
Swapnil Mishra
Ranch Hand
Posts: 218
1
VSCode Eclipse IDE Spring C++ Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
okok
 
She still doesn't approve of my superhero lifestyle. Or this shameless plug:
Paul Wheaton's 16th Kickstarter: Gardening playing cards for gardeners and homesteaders
https://coderanch.com/t/889615/Paul-Wheaton-Kickstarter-Gardening-playing
reply
    Bookmark Topic Watch Topic
  • New Topic