Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Can i use hibernate with exesting database?

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello every one.

I have a production database in mysql and i want to use some fields of some tables and their join relation with others tables in my application(Entities) .

Thanks
 
Saloon Keeper
Posts: 22492
151
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the JavaRanch, Abdo!

Actually, I don't recall if I've ever used Hibernate on anything that wasn't an existing database and I've used it with MySQL, PostgreSQL, DB2, Oracle, and probably one or 2 other DBMS's. Some of the database I've done this for have pretty extensive schemas.

There are tools that will take an existing schema and generate JPA classes from it, in fact.
 
abdo abdelmajid
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes Tim Holloway but my problem is don't want to use all fildes of table.
 
Tim Holloway
Saloon Keeper
Posts: 22492
151
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's OK. You only need to define Entity fields for the table columns that you actually want to be able to access from Java code.

Similarly, you don't have to define Entity classes for tables that you don't need Java access to, and you don't have to have a perfect mapping of relationships. Just define what you need. Add more later, if you need to.
 
abdo abdelmajid
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok I will try thanks.
 
Just the other day, I was thinking ... about 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
    Bookmark Topic Watch Topic
  • New Topic