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 to do complicate table relationship

 
James Liu
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone,
I am new in hibernate, when I check the samples or examples, I can only see the simple table relations, I have a simple questions, is it ok to setup the complicate tables relationship using hibernate?
For example, in our DB, we have about 500 tables, some times one select sql involve about 10-20 tables, when I try it using hibernate, I find it is really time comsuming doing the mapping, and it is much difficult to just write a sql, do I miss something or it is not for complicate mapping?

Thanks

James Liu
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes Hibernate can manage the type of relationships you need. It sounds like you are generating the mappings by hand. You might want to look at the generation tools avaliable from Hibernate: currently I can generate all the mappings (plus POJO, plus JDO classes) for our 200+ table schema with SchemaExport in around 30 seconds.
 
Dan Johnsson
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just want to issue a warning.

If you end up generating an entire object structure from the database, you will probably end up with something that is not very OO, and thus not very suited for maintaining in Java.
 
Krishna Radha
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
currently I can generate all the mappings (plus POJO, plus JDO classes) for our 200+ table schema with SchemaExport


Paul,
correct me if I am wrong. SchemaExport is used to generate the schema from the mapping files not vice versa. How are generating mapping files, POJO etc using SchemaExport?
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Quite right. Meant ddl2hbm. Which of course is not SchemaExport.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic