-->
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: Eclipse deletes *.hbm.xml files in the bin folder
PostPosted: Sun Feb 15, 2004 11:33 am 
Regular
Regular

Joined: Sat Oct 11, 2003 11:13 am
Posts: 69
When I click "rebuild project", Eclipse deletes the *.hbm.xml files which are inside the bin folder. I think it deletes everything which is not a *.class file.

Thats a problem because I need the *.hbm.xml files in this folder.

To preven the problem I could use something like:
Code:
Configuration cfg = new Configuration()
    .addFile("Vertex.hbm.xml")
    .addFile("Edge.hbm.xml");


But this is not so maintainable and secure like
Code:
Configuration cfg = new Configuration()
    .addClass(eg.Vertex.class)
    .addClass(eg.Edge.class);


So what can I do if Eclipse deletes all my *.hbm.xml files? How can I prevent this?

Its not really a Hibernate question, I know... But maybe there are Eclipse users here who know how to solve this problem.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 15, 2004 11:40 am 
Regular
Regular

Joined: Sat Oct 11, 2003 11:13 am
Posts: 69
I think I found the solution:

Windows > Preferences > Compiler > Build Path: Uncheck "Scrub output folders on full build"


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 15, 2004 12:39 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Just put your mapping files in the source folder.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 16, 2004 4:37 am 
Beginner
Beginner

Joined: Tue Nov 11, 2003 4:49 am
Posts: 47
Location: Florence, Italy
Quote:
Windows > Preferences > Compiler > Build Path: Uncheck "Scrub output folders on full build"

Never do this, or you will have OLD files in your class folder.
Instead, as gloeglm said, put all your files in the src folder (the one you configured into the Project settings), and Eclipse will put them into the bin dir.
Ciao.

_________________
Ciao.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 16, 2004 6:06 am 
Proxool Developer
Proxool Developer

Joined: Tue Aug 26, 2003 10:42 am
Posts: 373
Location: Belgium
By default eclipse uses the /bin directory as build directory...
Just tell it to use another Project -> Build Path -> Default output folder


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 16, 2004 9:19 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
brenuart wrote:
By default eclipse uses the /bin directory as build directory...
Just tell it to use another Project -> Build Path -> Default output folder


That won't help anything in this case, Eclipse will still scrub the new output folder. The thing to do is definately putting the mappings in the source folder.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 16, 2004 9:25 am 
Proxool Developer
Proxool Developer

Joined: Tue Aug 26, 2003 10:42 am
Posts: 373
Location: Belgium
gloeglm wrote:
brenuart wrote:
By default eclipse uses the /bin directory as build directory...
Just tell it to use another Project -> Build Path -> Default output folder


That won't help anything in this case, Eclipse will still scrub the new output folder. The thing to do is definately putting the mappings in the source folder.


It is true - mapping files must be considered as sources. This way Eclipse will copy them (as it does with other resources like config files) into the build directory.

My remark was more a warning: Eclipse uses the /bin folder as default build directory. Unfortunately, many people will use the same folder for other things - hereby introducing potential problems when Eclipse cleans up the build :-(

You have many solutions with Eclipse. You can configure it so it looks for sources from different folders (not only one) - you could then put your HBM in one folder and your Java files in another... But both folders must be declared as 'source' folder (cfr. your Eclipse project config).


Top
 Profile  
 
 Post subject: *.hbm.xml location
PostPosted: Mon Feb 16, 2004 5:14 pm 
Newbie

Joined: Wed Nov 05, 2003 9:10 am
Posts: 6
I keep them in a seperate directory (under WEB-INF) with my hibernate.cfg.xml file and make sure that it's added to the project's classpath (and any related files, e.g. build.xml) . That also seems to work, if you'd rather keep them in a separate place from your source files.


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.