-->
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.  [ 7 posts ] 
Author Message
 Post subject: HBM2DDL - Creating a schema outside the project
PostPosted: Mon Oct 09, 2006 10:43 am 
Beginner
Beginner

Joined: Thu Jun 29, 2006 8:41 am
Posts: 41
I created a little class that uses hbm2ddl to generate schemas.

If I point to the projects default hibernate.cfg.xml it works nicelly.

But I what I need it to do is to locate an outside hibernate.cfg.xml file (this I can do easely) and make it find the hbm files referenced in it (this is what I'm not being able to do).

So... what can I do to tell the program:

D:/test/hibernate.cfg.xml is where you find the cfg file (as I said... thsi part works...)

and

D:/test/(*whatever folder/files the hibernate.cfg.xml points in his mapping list*) is where you find the mappings. (this is what I'm desperate to make work).

_________________
Falci - Heavy Worker!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 09, 2006 11:49 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
i have no idea what you are talking about ;)

if hibernate.cfg.xml refers to files it will automatically be loaded by hibernate - no need to additional things.

p.s. you of course have to have those files on the disk (if you use file) or have them in the classpath (if you use resource)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 10, 2006 8:20 am 
Beginner
Beginner

Joined: Thu Jun 29, 2006 8:41 am
Posts: 41
Well, that's what happens...

When I have a folder outside my workspace with this structure:

<folder>
hibernate.cfg.xml
<subfolder>
*.hbm.xml

Where hibernate.cfg.xml has the files under the subfolder mapped, I can make the hbm2ddl find the file (using file, like you said) but hibernate will complain it can't find the files referenced by the cfg.

IF I have the same structure inside my workspace, the damned thing works. And hibernate finds the mapped files and creates the schema properly.

That's my problem. The final version of the program will have to work with files outside it's workspace.

_________________
Falci - Heavy Worker!


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 10, 2006 8:36 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
please show me your cfg.xml file then I can understand better (hopefully)

...the files in there of course needs to be available and if not how do you expect hibernate to reach them ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 10, 2006 12:30 pm 
Beginner
Beginner

Joined: Thu Jun 29, 2006 8:41 am
Posts: 41
There's nothing special about the cfg. It's just like anyother correct one. :P

As I said, the problem is where I put the file and the hbm.xml.

If I arrange everythin in a correct way (Like exemplified above) it works IF it's placed inside my program's folder (as if it were part of the program, being shown in eclipse/rad's package explorer).

It's like, I can use hbm2ddl to create schemas from hbm files inside the same project but I can't quite affect files anywhere in my hard drive even though it locates my hibernate.cfg.xml anywhere in my HD.

And I need it to operate anywhere in my HD, not just inside the folder.

A final attempt to make it clearer:

This works:
D:\Workspace\hbm2ddlProject\hbm2ddlpackacge\hbm2ddlclass
D:\Workspace\hibernateGeneric.cfg.xml (points hbm files under \test\pojo)
D:\Workspace\test\pojo\*.hbm.xml

This doesn't work:
D:\Workspace\hbm2ddlProject\hbm2ddlpackacge\hbm2ddlclass
D:\SomewhereElseInTheHd\hibernateGeneric.cfg.xml (points hbm files under \test\pojo, file is found by the application)
D:\SomewhereElseInTheHd\test\pojo\*.hbm.xml (files are not found by the application)

I hope I made it clearer now. :)

_________________
Falci - Heavy Worker!


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 10, 2006 12:34 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
your explanation doesn't say anything if you don't show how your cfg.xml actually looks like.

Without it my previous explanation is also enough - the files have to be available according to the mapping method you use in cfg.xml.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 19, 2007 7:41 am 
Newbie

Joined: Tue Jun 19, 2007 6:53 am
Posts: 7
Location: Hamburg, Germany
IMHO Falci wants to have the mapping files separated from the class files.

I posted something to this here: http://forum.hibernate.org/viewtopic.ph ... 95#2356095


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