With
Hibernate's new
EJB3 Annotation support, you can easily write classes, add annotations in code, and have Hibernate generate your database schemas for you without needing to manually build any xml config files or build your database schemas yourself. This is really bleeding edge though, so it has some issues. The Hibernate tools classes haven't caught up to the new feature set, for example, so when you try:
java -cp <classpaths> org.hibernate.tool.hbm2ddl.SchemaExport --config=hibernate.xml.cfgTo get the schema out so you can build your database, you get errors like:
org.hibernate.MappingException: An AnnotationConfiguration instance is required to use <blah>Even when everything is properly setup and you have included the Hibernate Annotations jars in your classpath. Fortunately, there is a simple workaround.