Sphene's Hibernate Autoadmin

Community

Copyright © 2007-2009 by Herbert Poul
You are not logged in.
Login
Register

Change Language:



AddThis Social Bookmark Button

A Django site.

Powered by Sphene Community Tools

Documentation

Documentation

1. Getting Started

Please see the GettingStarted guide for step-by-step instructions on how to download, compile and configure Sphene's Hibernate Autoadmin for the AutoadminTest example mapping.

2. Usage

The easiest usage is probably to simply download (see Downloads - the project HibernateAutoadmin) the sources (since there is no release yet) change into the directory 'meta' and run:

ant dist

This will result in a HibernateAutoadmin.war file which is ready to be deployed. After deployment you should add your hibernate configuration file to the classpath (probably WEB-INF/lib) as well as your mapping classes. (And all dependencies - like JDBC drivers & co)

Afterwards you have to tell Sphene's Hibernate Autoadmin where in the classpath to find the hibernate.cfg.xml file - to do so set the java environment variable net.sphene.hibernate.cfg

If anything is unclear please see the GettingStarted guide which explains most things in greater details, or visit the Forums and post your problems.

3. Meta properties

Sometimes the mapping information alone is not enough to create some kind of useful admin interface. Therefore Sphene's Hibernate Autoadmin introduces a few meta properties which can be set for class mappings.

For example let's take a look at the Poll mapping file (contained in the 'AutoAdminTest' SVN repository):

<class name="Poll" table="poll">
    <meta attribute="admin.toString">question + " (" + id + ")"</meta>
    <id name="id" type="long">
        <generator class="native" />
    </id>

    <property name="question" type="string" />
    <property name="description" type="text" />
    <property name="pubdate" type="date" />
</class>

This uses the meta attribute 'admin.toString' to define a OGNL expression which is evaluated to be displayed as a string representation of the object (e.g. for many-to-one relation ships) - If this is not defined it will simply call the 'toString()' method of the object.

Last Modified: 2007-05-01 00:04:55 by Herbert Poul - [ Snip Changes ] [ Wiki History ]



Powered by Sphene Community Tools