aspose file tools
The moose likes Object Relational Mapping and the fly likes hibernate and eclipse Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Reply Bookmark "hibernate and eclipse" Watch "hibernate and eclipse" New topic
Author

hibernate and eclipse

miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
i'm posting here because i hope someone using hibernate AND eclipse can help me

my problem: using eclipse 3.1 (beta) and hibernate, i place hibernate.cfg.xml along with log4j.properties inside bin directory

all works fine till i have to change something at project properties: from this moment on, eclipse simply deletes those two files!

how can i assure they stay there forever?
how can i add them to classpath permanently?

TiA


java amateur
Todd Farmer
Ranch Hand

Joined: May 28, 2004
Posts: 59
When you say you add them to the bin directory, what exactly are you refering to?
miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
my workspace has a root folder and inside has a src and a bin (for class files) directories. I guess bin is (for eclipse) the root of classpath; anyway is there where hibernate finds log4j.properties and hibernate.cfg.xml
[ July 04, 2005: Message edited by: miguel lisboa ]
Todd Farmer
Ranch Hand

Joined: May 28, 2004
Posts: 59
Try putting it in your src folder. That's where I put those files for my projects (actually, I use Maven, but I still put them in the source folders rather than the build folders that contain compiled .class files).

Todd Farmer
miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
thanks for your idea

that really works: i guess when eclipse makes a full rebuild deletes everything under 'bin' - so there go away my files

but under 'src' nothing is touched: very cool

Jack Wiesenthaler
Ranch Hand

Joined: Jul 26, 2001
Posts: 75
eclipse deletes everything under the output folder. I usually just have an ant task that synchs any config files with the output after full compilation.

BTW, it is usually called classes not bin, that is not the standard per the J2EE webapp spec.
Steven Bell
Ranch Hand

Joined: Dec 29, 2004
Posts: 1071
Originally posted by Kevin Arouza:

BTW, it is usually called classes not bin, that is not the standard per the J2EE webapp spec.


Why do you assume it's a webapps?
Dave Turkel
Greenhorn

Joined: Sep 17, 2003
Posts: 9
It depends what you are doing.

I usually set my project's output directory to "internal-build" so I know exactly what Eclipse has built. I do keep a bin directory for scripts and such. Config files I'll put under "src" or make a folder called "config".

If I need the config file to run something, I'll include it in the "run" task's classpath. This keeps things clean for an Ant build (I haven't used Maven).

This is also useful for architecting multiple config sub-directories based on environmental concerns (test/staging/dev databases etc.)
miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
my app is a home made one
anyway i got curious aboutcreating folders to have all those .hbm in one place

now i've a prob: how to tell hibernate all my .hbm now are at /config?

TiA
Dave Turkel
Greenhorn

Joined: Sep 17, 2003
Posts: 9
I believe you can just add that path to your project's classpath. I have a main hibernate.cfg.xml, with separate *.hbm.xml files for each "hibernated" class.

My hibernate.cfg.xml references each of the .hbm.xml files. I'm not sure if it assumes items are in the same directory, or will use the Classloader to find them.

When you create a build, you'll need to make sure that either the mapping files are in the root of one of your JAR files, or that they are placed in a directory that your application server can see. There are other ways of packaging as well, but these two seem to be the simplest in my limited experience.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: hibernate and eclipse
 
Similar Threads
Add New Dialects
java(ireport connection with spring loaded Hibernate)
How can i include Hibernate jar file in to Eclipse IDE
hibernate.cfg.xml required in version 2.x?
Hibernate plugin in Eclipse