-->
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.  [ 8 posts ] 
Author Message
 Post subject: Automatic binding of mapping files
PostPosted: Thu May 20, 2004 9:45 am 
Beginner
Beginner

Joined: Wed Nov 05, 2003 7:51 am
Posts: 22
Hi,

I have a huge amount of mapping files generated by XDoclet and I wouldn't like to manually enter them one-by-one into the hibernate.cfg.xml file as <mapping .../> tags. (I configure Hibernate with this xml file at startup).

Is there a way to tell Hibernate to find all of the mapping files in a certain directory or in a directory structure starting in a certain directory?


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 20, 2004 9:58 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
You can jar them up and have Hibernate load all the mappings in the jar.


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 20, 2004 10:37 am 
Beginner
Beginner

Joined: Wed Nov 05, 2003 7:51 am
Posts: 22
Yes, I saw this possiblity but this method is not described in the documentation. Nevertheless, I tried it but not with too much success yet.

When I tried the <mapping jar="hibernate-mappings.jar"/> tag, Hibernate threw an exception supposedly because it didn't find the jar file (or the mapping files may not be in subfolders in the JAR file). Are you sure this option is really available (I thought it may be some experimental feature and that is why it is not mentioned in the docs)

I think the best solution will be to somehow patch the new XDoclet 1.2.1 into Eclipse3M8 which supports generating the hibernate.cfg.xml as well not only the mapping files.
I use the latest JBossIDE but it seems to include only an older XDoclet (it seems to be 1.2).


Top
 Profile  
 
 Post subject: Re: Automatic binding of mapping files
PostPosted: Thu May 20, 2004 12:30 pm 
Beginner
Beginner

Joined: Mon Feb 09, 2004 3:06 pm
Posts: 26
Location: Tampa, FL
steve wrote:
You can jar them up and have Hibernate load all the mappings in the jar.


I've tried this with ear deployed on JBoss and I could not get hibernate to find the jar.

Here's my original post:

http://forum.hibernate.org/viewtopic.php?t=928885

Any ideas why this does not work?

_________________
Bill Pfeiffer


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 20, 2004 12:34 pm 
Beginner
Beginner

Joined: Mon Feb 09, 2004 3:06 pm
Posts: 26
Location: Tampa, FL
sola wrote:
I think the best solution will be to somehow patch the new XDoclet 1.2.1 into Eclipse3M8 which supports generating the hibernate.cfg.xml as well not only the mapping files.


I just tried the latest XDoclet 1.2.1 and it will generate the hibernate.cfg.xml, BUT, if you hand code any of your hbm.xml files, it doesn't appear to pick those up. This makes it kind of useless for me as we both generate and hand code some of the mapping files. If you are generating ALL of the hbm.xml files, XDoclet 1.2.1 seems to work well.

Bill

_________________
Bill Pfeiffer


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 20, 2004 12:55 pm 
Beginner
Beginner

Joined: Wed Nov 05, 2003 7:51 am
Posts: 22
Why don't you use XDoclet merging for the parts you hand-code? If you merged your parts into the generated xml file it would include the mapping file into the list, wouldn't it?


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 20, 2004 1:09 pm 
Beginner
Beginner

Joined: Mon Feb 09, 2004 3:06 pm
Posts: 26
Location: Tampa, FL
Yeah, I thought about that but I still end up hand jamming the references to the non-XDoclet created mapping files. I'm starting to use Middlegen to generate the mappings, so I'm really not saving myself much work by using the merge point. The generated mappings are already in the config file; the new ones generated by Middlegen will all have to be hand jammed anyway.

I'd just like the whole set of mapping files (XDoclet generated and otherwise created) to be picked up by XDoclet. It seems like a reasonable thing to be able to point at the directory roots where the mapping files exist and have them picked up.

I think I saw a discussion on the mailing lists that this feature may already be in XDoclet CVS. I guess I'll wait for that.

_________________
Bill Pfeiffer


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 20, 2004 1:33 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
There's been a few discussion about getting addJars to work. Here's one:http://forum.hibernate.org/viewtopic.php?t=68&highlight=addjar

Do a forum search for others if you need more.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 8 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.