-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 11 posts ] 
Author Message
 Post subject: Consolidation of seperate mapping files into a single .hbm
PostPosted: Mon Mar 03, 2008 1:58 am 
Senior
Senior

Joined: Mon Feb 25, 2008 1:48 am
Posts: 191
Location: India
I have generated the hibernate mapping files for all the tables available in a particular schema. Now, in my project we are supposed to maintain a single hiberante mapping file. Is there a way to generate all the mappings in single hibernate mappings into a single .hbm.xml file or should I do it manually only?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 05, 2008 12:04 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
you can merge them with some xml transformation if you want to.

But seriously - large monolithic mapping files are bad.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 05, 2008 12:15 am 
Senior
Senior

Joined: Mon Feb 25, 2008 1:48 am
Posts: 191
Location: India
Quote:
But seriously - large monolithic mapping files are bad

But don't you think managing 250 mapping files in project can be tedious? And wouldn't it be good to change a single file if you want to set a global property instead of changing all the files?

Quote:
you can merge them with some xml transformation if you want to

Anyway I have written a java code to consolidate the XML files into a single mapping file. I was just wondering if hibernate tools could handle by itself by some minor setting or tweek.

_________________
Sukirtha


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 05, 2008 8:50 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
would you put 250 .java files into one big .java file to make it easier to manage ?

What global properties are you referring to that can't be set in individual files ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 06, 2008 1:19 am 
Senior
Senior

Joined: Mon Feb 25, 2008 1:48 am
Posts: 191
Location: India
Quote:
would you put 250 .java files into one big .java file to make it easier to manage ?


I agree your point. I'll think about it... ;)

Quote:
What global properties are you referring to that can't be set in individual files ?


Example, All my classes wil inherit the extend the same class. I which case all the .hbm files will have to replicate the same<meta attribute"extends">parent.java</meta>. Or another example could be putting in a copy right notice in the created java classes using a global meta tag. Or maybe there is another way to handle it which I am not aware of :)

_________________
Sukirtha


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 06, 2008 5:13 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
Quote:
Quote:
What global properties are you referring to that can't be set in individual files ?


Example, All my classes wil inherit the extend the same class. I which case all the .hbm files will have to replicate the same<meta attribute"extends">parent.java</meta>. Or another example could be putting in a copy right notice in the created java classes using a global meta tag. Or maybe there is another way to handle it which I am not aware of :)

[/quote]

ah yes..some meta attributes is rather annoying not being able to set globally. I need to get around fixing that.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 06, 2008 5:24 am 
Senior
Senior

Joined: Mon Feb 25, 2008 1:48 am
Posts: 191
Location: India
Quote:
ah yes..some meta attributes is rather annoying not being able to set globally

So in that case... What would you suggest? Create seperate hbm files or have a single file? I am still confused!

_________________
Sukirtha


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 06, 2008 6:14 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
well if global meta properties are important for you then single file is best since that is not easy to do for individual files

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 06, 2008 6:19 am 
Senior
Senior

Joined: Mon Feb 25, 2008 1:48 am
Posts: 191
Location: India
Then in that case I guess it would be nice to have feature to provide a single file generation. ;) But for now I will do it using XML transformation. Thanks for your help!

_________________
Sukirtha


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 06, 2008 7:56 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
well i would rather work on having a way to specify global meta attributes ,)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 06, 2008 8:03 am 
Senior
Senior

Joined: Mon Feb 25, 2008 1:48 am
Posts: 191
Location: India
In that case -- I am stuck with the java code forever... Project standards ;)

_________________
Sukirtha


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 11 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.