Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate in action: All Jar files in lib folder?

 
Frank Malinowski
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have another book about Hibernate and it recommends placing all of the Hibernate, Hibernate Extensions, and HSQLDB jar files into a lib directory at the base level of your project directory. It seems to me that this requires you to either develop all projects in the same directory structure or to have multi-megabyte lib directories in every project directory.

Do you agree with this setup or does your book recommend proceeding another way?

I'm asking because I am just starting to learn Hibernate and Ant and when I set up Ant I simply set a couple of environment variables so that my system knew where to find Ant and then I could use it to build any project, no matter where it is located in the directory structure. It seems that something similar to this would be the best solution for Hibernate as well.

Thanks,

Frank Malinowski
 
Christian Bauer
author
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, this is usually the job of your IDE. For example, I point all my work to a central Hibernate 2.1 directory, which is mapped as a "Global Library" in IntelliJ IDEA. There should be something similar in Eclipse.
 
Gavin King
author
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is usual to copy all dependant jars into the lib directory of a project. I dunno about the stuff in HibernateExt though, that seems a bit strange...
 
Gavin King
author
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you do it that way Christian?

That is not really the Done Thing in eclipse-land, I think...
 
Christian Bauer
author
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a separate Global Lib, which is called "HibernateExt", and it will add its lib/src/doc path to my project.
 
Alexandru Popescu
Ranch Hand
Posts: 995
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
all of the Hibernate, Hibernate Extensions, and HSQLDB jar


I hope you are not really meaning that. The README file in the lib directory of Hibernate distro gives you the exact list of needed jars.

However for working inside an IDE (just for editting you need only hibernate jar and commons-lang). For running your application from inside read the above.
 
Frank Malinowski
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ali Pope:


I hope you are not really meaning that. The README file in the lib directory of Hibernate distro gives you the exact list of needed jars.

However for working inside an IDE (just for editting you need only hibernate jar and commons-lang). For running your application from inside read the above.


Yes, I really mean that. I am simply telling you what the Hibernate book that I currently own says to do.

Second, I am not using an IDE at the moment. I am doing everything via the command line.

Finally, the README file tells you how to run the Demo and Tests that come with Hibernate. This doesn't tell me how to set it up when running my own projects.

FYI, the book in question tells you to set up a project hierarchy as follows:

1) Create a project directory.
2) Create subdirectories: src, lib, data.
3) Copy hsqldb.jar to your project/lib directory.
4) Locate the lib directory in the Hibernate directory and copy ALL of its contents into your own project lib directory.
5) Copy hibernate2.jar into your project/lib directory.
6) Copy the entire contents of hibernate-extensions-2.1.2/tools/lib into your project/lib directory.
7) Copy hibernate-tools.jar into your project/lib directory

It even tells you what the contents of your project/lib directory will be after this process and it contains 43 items weighing in at 11.3MB.

This is the reason I asked for advice. I'm new to Hibernate but this seemed odd to me.

Frank
 
Alexandru Popescu
Ranch Hand
Posts: 995
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
:-(. Please take into account my suggestions. They will work.

Maybe, the hibernate extension will be needed if you use Hibernate Ant tasks to build the project.

Good luck cleaning the project! ;-)
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Let me state that it makes sense to include the dependencies of a project in the same version control system. If all your projects are pointing to a single, centralized library, you're practically forced to upgrade all your projects at the same time...
 
Frank Malinowski
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ali Pope:
:-(. Please take into account my suggestions. They will work.

Maybe, the hibernate extension will be needed if you use Hibernate Ant tasks to build the project.

Good luck cleaning the project! ;-)


I read the wrong README file earlier and see what you were referring to now. However, since I am new to Enterprise development I'm still unsure when the "optional" jars would be needed so it seems that I should probably include them when starting out.

I will probably try the IDE suggestion at a later date.

Frank
 
somkiat puisungnoen
Ranch Hand
Posts: 1312
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Now, i'm use Eclipse to develop application with Hibernate.

I'm MUST use hibernate extension (hibernate-tools.jar) for code generation.




And more in lib directory you must have follow in /lib/readme.txt ::

ant.jar (1.5.3)
- Ant core
- buildtime

c3p0.jar (0.8.4.5)
- C3P0 JDBC connection pool
- runtime, optional

cglib-full.jar (2.0.1)
- CGLIB bytecode generator
- runtime, required

commons-collections.jar (2.1)
- runtime, required

commons-dbcp.jar (1.1)
- runtime, optional

commons-lang.jar (1.0.1)
- runtime, optional (required by JCS)

commons-logging.jar (1.0.3)
- runtime, required

commons-pool.jar (1.1)
- runtime, optional

concurrent.jar
- runtime, optional (required by TreeCache)

connector.jar
- Standard JCA API
- runtime, optional

dom4j.jar (1.4)
- XML configuration & mapping parser
- runtime, required

ehcache.jar (0.7)
- EHCache cache
- runtime, required (default cache provider)

hibernate2.jar (2.0)
- Hibernate core
- runtime, required

jaas.jar
- Standard JAAS API
- runtime, optional (required by JCA)

jboss-cache.jar (CVS-11.12.03)
- TreeCache clustered cache
- runtime, optional

jboss-common.jar
- runtime, optional (required by TreeCache)

jboss-jmx.jar
- runtime, optional (required by TreeCache)

jboss-system.jar
- runtime, optional (required by TreeCache)

jcs.jar (1.0-dev)
- JCS cache
- runtime, optional (deprecated)

jdbc2_0-stdext.jar
- Standard JDBC APIs
- runtime, required for standalone operation (outside application server)

jgroups.jar (2.2.1)
- JGroups multicast library
- runtime, optional (required by replicated caches)

jta.jar
- Standard JTA API
- runtime, required for standalone operation (outside application server)

junit.jar (3.8.1)
- JUnit test framework
- buildtime

odmg.jar (3.0)
- ODMG API 3.0
- runtime, required

optional.jar (1.5.3)
- Ant optional tasks
- buildtime

oscache.jar (2.0)
- OpenSymphony OSCache
- runtime, optional

proxool.jar (0.8.3)
- Proxool JDBC connection pool
- runtime, optional

swarmcache.jar (1.0rc2)
- SwarmCache replicated cache
- runtime, optional

xalan.jar (2.4.0)
- XSLT processor
- runtime, required

xerces.jar (2.4.0)
- SAX parser
- runtime, some SAX parser is required

xml-apis.jar
- Standard JAXP API
- runtime, some SAX parser is required
 
Alexandru Popescu
Ranch Hand
Posts: 995
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Somkiat Puisungnoen:
And more in lib directory you must have follow in /lib/readme.txt


I think that when the README refers to buildtime it refers in fact of building Hibernate distro.

Working with Eclipse (just for editing) requires only hibernate2 and commons-lang jars. As for real deploy I use only a few of the enumerated jars (cglib, commons (collections, dbcp, lang, logging, pool), connector - I run inside a container -, dom4j, ehcache, jdom, odmg, xalan, xerces, xml-apis).

/pope
 
somkiat puisungnoen
Ranch Hand
Posts: 1312
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ali Pope:


I think that when the README refers to buildtime it refers in fact of building Hibernate distro.

Working with Eclipse (just for editing) requires only hibernate2 and commons-lang jars. As for real deploy I use only a few of the enumerated jars (cglib, commons (collections, dbcp, lang, logging, pool), connector - I run inside a container -, dom4j, ehcache, jdom, odmg, xalan, xerces, xml-apis).

/pope


And you should be use jta.jar for standalone application...

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic