Sphene's Hibernate Autoadmin

Community

Copyright © 2007-2018 by Herbert Poul

You are not logged in.
Login
Register

Change Language:



AddThis Social Bookmark Button

A Django site.

Powered by Sphene Community Tools

Getting Started

GettingStarted

This is a step-by-step guide on how to download, compile and configure Sphene's Hibernate Autoadmin to set up something like http://sphene.net:8080/HibernateAutoadmin/ (or .. exactly like it)

Since it should be a very basic tutorial I make a few assumptions:

1. Requirements

2. Download

Run the following commands:

svn co http://yourhell.com/svn/sphene/hibernateautoadmin/trunk/HibernateAutoadmin
svn co http://yourhell.com/svn/sphene/hibernateautoadmin/trunk/AutoadminTest

This should give you two subdirectories.

3. Compiling

Change into the 'HibernateAutoadmin/meta' directory and run:

ant dist

Now the same for the 'AutoadminTest/meta' directory:

ant buildjar

Very sophisticated, isn't it ? ;)

It should give you two archives:

4. Deployment

Copy the file HibernateAutoadmin/meta/build/HibernateAutoadmin.war to your tomcat/webapps/ directory.

Now start tomcat so the web application gets deployed. Afterwards you should have a webapps/HibernateAutoadmin/ directory.

Copy the files:

to your tomcat/webapps/HibernateAutoadmin/WEB-INF/lib directory.

5. Configuration

You need to tell Sphene's Hibernate Autoadmin where to find the hibernate configuration file - and... what database to use.. obviously..

So first of all, copy AutoadminTest/meta/dist/example-hibernate.cfg.xml to your tomcat/shared/classes directory. (You can keep the name hibernate.cfg.xml).

Now we need to set the system variable 'net.sphene.hibernate.cfg' and assign it the value 'example-hibernate.cfg.xml'. For tomcat the easiest way to accomplish this is by editing/creating the file tomcat/bin/setenv.sh (or setenv.bat for windows) and adding the following line:

export JAVA_OPTS="-Dnet.sphene.hibernate.cfg=example-hibernate.cfg.xml"

(On windows use: set JAVA_OPTS="...")

5.1. Database setup

This is probably the most annoying thing of all time.. And since we don't want to setup a real database, let's stick with a simple memory database - HSQL. the example-hibernate.cfg.xml is already configured correctly - but on each startup the data will be erased and the database layout will be recreated from scratch.

5.2. User setup

By default the webapplication is protected by BASIC authentication and requires the role 'autoadmin'. So we need to create this. Edit the file tomcat/conf/tomcat-users.xml and add the following two lines:

<role rolename="autoadmin" />
<user username="demo" password="demo" roles="autoadmin" />

(You can adjust demo/demo as you like, but autoadmin is defined in HibernateAutoadmin/WEB-INF/web.xml)

6. Enjoy !!!

So. This should be it. You're Done ... Kind of.

Open your browser and head over to http://localhost:8080/HibernateAutoadmin/ and you should see your brand new Sphene's Hibernate Autoadmin interface. Congratulations ;)

7. And Now ?

The next step would probably be for you to remove the example-hibernate.cfg.xml and add the hibernate configuration, mapping and java beans from your own application and try it out in a real-world application.

8. Feedback

If you've tried Sphene's Hibernate Autoadmin please let me know your thoughts in the Forums - Thanks ! :)

Last Modified: 2007-04-30 23:52:19 by Herbert Poul - [ Snip Changes ] [ Wiki History ]

Comments

No comments yet.



Powered by Sphene Community Tools