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

Can i use hibernate with exesting database?

 
abdo abdelmajid
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
 
Tim Holloway
Saloon Keeper
Posts: 18367
56
Android Eclipse IDE 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: 18367
56
Android Eclipse IDE 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic